On 2009.05.20 at 15:03:09 +0300, Lior Aharoni wrote: > Hi Victor, > > Thank you for the quick reply. > I did try to use d2i_X509 function but I get the following error: > > 2520:error:0D07207B:lib(13):func(114):reason(123):.\crypto\asn1\asn1_lib.c:150:
First of all, you should call ERR_load_crypto_strings() in your program before doing anything else with OpenSSL functions. Thus you'll receive much more readable error messages. It seems that you are passing wrong buffer to d2i_X509 function or incorrectly pass buffer length. d2i_X509 expects following arguments: 1. Pointer to pointer to pointer to X509 structure to fill. If is NULL, fresh one would be allocated 2. Pointer to pointer to input buffer. pointer to buffer, pointed by this argument, would be incremented to point to first unparsed byte in the buffer 2. Length of buffer. Your error means that length of ASN1 structure as determined by parsing is bigger than specified length. If you pass data correctly, it means that there is something else in the beginning of the buffer, than binary DER representation of certificate. > > It is d2i_X509 function. It has same API as all other d2i functions and > return X509 structure which can be passed to various OpenSSL information > functions. Unfortunately, this part of OpenSSL is quite poorly > documented. > > ______________________________________________________________________ > OpenSSL Project > [2]http://www.openssl.org > User Support Mailing List > [3]openssl-us...@openssl.org > Automated List Manager > [4]majord...@openssl.org > > -- > Lior Aharoni > > References > > Visible links > 1. mailto:vi...@cryptocom.ru > 2. http://www.openssl.org/ > 3. mailto:openssl-users@openssl.org > 4. mailto:majord...@openssl.org ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org