Hello,
> I am sending my Query again ..
> 
> Is there any OpenSSL API which would give me the Key Type and its PEM
> Length if I pass the buffer containing the Private Key in DER /PEM
> format to it ??
> 
> Can anyone tell me how to get the Private Key Type(DSA /RSA ) and its
> PEM Length  given the buffer containing the Private Key in PEM / DER
> format.
If you have buffer in PEM format, key tape can be read from
first "line" (for example: -----BEGIN DSA PRIVATE KEY-----)

If you have buffer in DER format (ASN1 or other form) there
is no such information and in general you must know what you have
or what you expect to get.

Or you may do some sort of guessing depending on key source:
 - RSA private key - ASN1 SEQUENCE of 9 INTEGERS (generic - file)
 - DSA private key - ASN1 SEQUENCE of 6 INTEGERS (generic - file)
 - RSA & DSA public key from certificate - RFC2459
 - RSA public key in DNS - RFC3110
So public key format (which is transfered from peer to peer)
depends on application - guessing may be not good idea.

Best regards,
-- 
Marek Marcola <[EMAIL PROTECTED]>

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

Reply via email to