note 98282 added to function.openssl-verify

From: Date: Mon, 07 Jun 2010 04:04:45 +0000
Subject: note 98282 added to function.openssl-verify
Groups: php.notes 
Request: Send a blank email to php-notes+get-169929@lists.php.net to get a copy of this message
I spent days scouring the php openssl documentation trying to figure out how to do what sounds like a simple task - given two PEM encoded certificates, is one the signer of the other? Nowhere in the openssl_verify() documentation or comments is it explained where to obtain the signature of an existing certificate. The openssl_x509_parse() function looked promising, but it is an unstable API that may change. I had to write my own code to determine if one cert signed another, it is located here: http://badpenguins.com/source/misc/isCertSigner.php?viewSource In a nutshell here is what I learned... The signature data in a signed X.509 certificate contains DER formatted data about the signature that is encrypted with the signers public key. The data contains a hash of the original subject certificate and information about what encryption algorithm was used to create the signature. So you need to get this signature data and a copy of the original certificate with the issuer and signature sequences removed. Hash a copy of the original certificate (sans issuer/signature sequences) with the same algorithm the issuer used and if the hashes match, you have the issuer cert that signed the certificate. ---- Server IP: 208.69.120.55 Probable Submitter: 70.128.42.132 ---- Manual Page -- http://www.php.net/manual/en/function.openssl-verify.php Edit -- https://master.php.net/note/edit/98282 Del: integrated -- https://master.php.net/note/delete/98282/integrated Del: useless -- https://master.php.net/note/delete/98282/useless Del: bad code -- https://master.php.net/note/delete/98282/bad+code Del: spam -- https://master.php.net/note/delete/98282/spam Del: non-english -- https://master.php.net/note/delete/98282/non-english Del: in docs -- https://master.php.net/note/delete/98282/in+docs Del: other reasons-- https://master.php.net/note/delete/98282 Reject -- https://master.php.net/note/reject/98282 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#169929) next »