The RSA key components are as follows:

        n       - modulus, mandatory for public and private
        e       - public exponent, mandatory for public
        d       - private exponent, mandatory for private
        p, q, dmp1, qmp1, iqmp  - optional for private

If the key contains (n, e, d) then it contains the public and private
components and can be used as both a public and private key.  If d is NULL,
but n and e are not, then it will be a public key.  I doubt you'll ever find
the case where e is NULL, but n and d are not, but if you do then it is a
private key; a private key will contain all three of these components and
most likely the optional components also.

The problem that you were having the other day was due to passing a public
key (d == NULL) to RSA_check_key and, as I pointed out, the code
dereferences d which causes the crash.

Steven
--
Steven Reddie <[EMAIL PROTECTED]>
Senior Software Engineer
Computer Associates Pty Ltd (Australia)


> -----Original Message-----
> From: Kubyshev Andrey [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, February 28, 2001 8:22 AM
> To:   [EMAIL PROTECTED]
> Subject:      Private or public
> 
> Hello openssl-users,
> 
>   How to check if RSA * points to private or public key ?
>   Dont advice RSA_check_key crashes - see previous letter.
>   thank you for attention.
> 
> -- 
> Best regards,
> Andrey Kubyshev                          mailto:[EMAIL PROTECTED]
> 
> 
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to