php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #39956 Verifying the signature of the certificate
Submitted: 2006-12-26 21:30 UTC Modified: 2007-01-18 00:48 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: bassijunior at yahoo dot com dot br Assigned: pajoye (profile)
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.0 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bassijunior at yahoo dot com dot br
New email:
PHP Version: OS:

 

 [2006-12-26 21:30 UTC] bassijunior at yahoo dot com dot br
Description:
------------
Hi, 

I was developing a code that need some openssl functions.

I was studying the openssl functions of PHP and I did not  find nothing to verifying the signature of X.509 certificate.

The openssl_verify function verifies a string.

But, what can I do to verify the signature of  a certificate, like this: 

-----BEGIN CERTIFICATE----- MIICxjCCAi+gAwIBAgIBADANBgkqhkiG9w0BAQQFADCBqDEPMA0GA1UEAxMGRk9S QklTMQswCQYDVQQGEwJMVDEQMA4GA1UEBxMHVklMTklVUzEQMA4GA1UECBMHVklM TklVUzEoMCYGA1UEChMfVVpEQVJPSkkgQUtDSU5FIEJFTkRST1ZFIEZPUkJJUzEU MBIGA1UECxMLSU5URUdSQVRJT04xJDAiBgkqhkiG9w0BCQEWFUwuSlVaSUtFTkFT QEZPUkJJUy5MVDAeFw0wNDAzMjIxNTE2MDNaFw0wNDA0MjExNTE2MDNaMIGoMQ8w DQYDVQQDEwZGT1JCSVMxCzAJBgNVBAYTAkxUMRAwDgYDVQQHEwdWSUxOSVVTMRAw DgYDVQQIEwdWSUxOSVVTMSgwJgYDVQQKEx9VWkRBUk9KSSBBS0NJTkUgQkVORFJP VkUgRk9SQklTMRQwEgYDVQQLEwtJTlRFR1JBVElPTjEkMCIGCSqGSIb3DQEJARYV TC5KVVpJS0VOQVNARk9SQklTLkxUMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB gQCrbyCkLdo1gfT3d5JjwrLYC8WAXNI50afTGx9+ncjfnONGtScsbwlQ5Qw55neH TUe1TbI/QJc8KZ7PU5/sJAVNpuJW9JEI0y1xX6egfVSWkDGv/GgSb2JebnD1+Nw2 fw8lU0v4F6/IjHU9FOfSTBAIN58g5FqTweAZg5BU7uN9XwIDAQABMA0GCSqGSIb3 DQEBBAUAA4GBACh8eFBJ/8p8f1t8TWlh6lX4hpGpyej0h+0BW45icxkpDplfGbFx 47OClHjzgROo6zFx7Axn5JC1IWPiiyylbSbahpyCpcasuQchErcXJ72ctq8nBXqV s7sPhlunemdfpFuZLBNFbw5xaUs+lt9tAZFi6EHnhjCFGilH4u5aRcta -----END CERTIFICATE-----


I have the public key to verify it. But I do not Know how  I use it.

Thanks!




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-05 19:18 UTC] bassijunior at yahoo dot com dot br
Hi, 

Some news?

I need a help.

Thanks
 [2007-01-05 21:06 UTC] pajoye@php.net
"The openssl_verify function verifies a string."

$cert = file_get_contents($pem_filename);
...
$ok = openssl_verify($data, $signature, $cert);
if ($ok)...

assuming that $data and $signature are filled.

But this is not a bug but a support question > bogus.
 [2007-01-11 14:33 UTC] bassijunior at yahoo dot com dot br
Ok.
Thanks for the answer. Maybe, I have to use this function.
But, how can extract the signature value from the certificate X.509? I already tried the openssl_x509_parse, but I didn't get the signature value.
I have the certificate in the format .PEM, like this:

-----BEGIN CERTIFICATE-----
MIIDRDCCAq2gAwIBAgIERaJ12TANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJC
UjELMAkGA1UECBMCUkoxFzAVBgNVBAcTDlJpbyBkZSBKYW5laXJvMRwwGgYDVQQD
FBNBR0MgLSBQcm9qZXRvX0ZpbmFsMScwJQYJKoZIhvcNAQkBFhhiYXNzaWp1bmlv
ckB5YWhvby5jb20uYnIwHhcNMDcwMTA4MTY0ODI1WhcNMDgwMTA4MTY0ODI1WjCB
1DELMAkGA1UEBhMCQlIxCzAJBgNVBAgTAlJKMQ0wCwYDVQQHEwRSaW8gMRwwGgYD
VQQDExNKb3NlIEFsYmVydG86MzI0MzQzMWUwYwYDVQRBE1xBcnF1aXZvOiBiYWNr
MS5qcGcsIEhhc2g6IGRmNjVmZDFlOTcwM2Q2MTM1ZWU2NjNhNjlkZDA4NTJjYzZj
MTU1ZjEsIElQIGRvIHVzdWFyaW86IDEyNy4wLjAuMTEkMCIGCSqGSIb3DQEJARYV
YmFzc2lqdW5pb3JAZ21haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
gQC+/l11fmU8ZsipmXA+oBKQml6dpHupANKOiR/NUynn3g3+TVeBi8LOu5zLz1V9
4Qj8STvzepoxsJ/uuIhieS9sPtu4Erg5Xi4QvEZPRCxzzTH6237z924sFK+RjiaA
Oz7voL48y6+EWzdlX81fCUADsA1ps3AgTm2nICldPNWqhwIDAQABo3wwejAJBgNV
HRMEAjAAMC0GCWCGSAGG+EIBDQQgFh5DZXJ0aWZpY2FkbyBmaW5hbCBwYXJhIHVz
dWFyaW8wHQYDVR0OBBYEFHz+89um4yL1HYMzCJqVldQ9w4QnMB8GA1UdIwQYMBaA
FLRXYeje0vAjbdOpIQmMW5EzaQEpMA0GCSqGSIb3DQEBBQUAA4GBAMffIowvU8K5
Q5xyNt7MyTpH/2GtO01bPlrXxEP8XJVHQS9UK7F4lRks6lSmN4yNrbmgiO94JbzM
6xdaH3EofROnMKT/A4SMbpUNNUDClC+DiSBWw3mN+3D2wzakLrCszXrqe21dO1fC
0JB5xjnKJjvZtdLD7/s87eCUNntaN81E
-----END CERTIFICATE-----

I need to verify a certificate X.509.

Thanks!
 [2007-01-18 00:48 UTC] bassijunior at yahoo dot com dot br
Hi, 
Can you help me?
How can I extract the signature value from the certificate X.509?
Thanks
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 09:01:28 2025 UTC