RSA keypair, right?  If so, compare that the modulus of both the
certificate and the private key is equal.  These two commands do the
trick:

openssl x509 -in cert.pem -modulus -noout

openssl rsa -in rsa.pem -modulus -noout


If on Unix, I imagine you can do this (ahhh... the glorious back-tick!):

TEST1=`openssl x509 -in cert.pem -modulus -noout`
TEST2=`openssl rsa -in rsa.pem -modulus -noout`
if [ "$TEST1" = "$TEST2" ]; then echo 'equal'; else echo 'not equal'; fi;


(Is it okay to only check the modulus?  The public exponent can be
ignored?  Is it always "Exponent: 65537 (0x10001)"?)


yours,

Julius


On 2/19/07, Mark H. Wood <[EMAIL PROTECTED]> wrote:
Is there a built-in command in the openssl utility which can verify
that a private key and a certificate represent a valid keypair?  Or is
there some simple way to determine this using other built-in commands?

--
Mark H. Wood, Lead System Programmer   [EMAIL PROTECTED]
Typically when a software vendor says that a product is "intuitive" he
means the exact opposite.





--
yours,

Julius Davies
416-652-0183
http://juliusdavies.ca/
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to