Given an RSA private key, you can regenerate its matching public key with this:

% openssl rsa -in privatekey.pem -pubout >key1.pem

The public key in a certificate can be extracted with this:

% openssl x509 -in certificate.pem -pubout -noout >key2.pem

With the two public keys, you should be able to compare the two to find a match. The following will display all the fields of the public keys.

% openssl rsa -in keyX.pem -pubin -text -noout

There may be a way to automate this, but I don't see anything in the man pages (yet).


On Nov 20, 2003, at 3:35 AM, Jia L Wu wrote:

Hi,
Given a x509 certificate or several certificates (e.g. produced from
openssl pkcs7 -out_prints), which openssl command or function can I use to
find the certificate that matches the private key or check if they are
match? Thank you.

Wu

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Attachment: smime.p7s
Description: S/MIME cryptographic signature



Reply via email to