On Thu, Nov 20, 2003, Joseph Bruni wrote:

> 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).
> 

An alternative for RSA keys is to use the -modulus switch in the rsa and the
x509 commands:

openssl x509 -in cert.pem -noout -modulus
openssl rsa -in key.pem -noout -modulus

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to