Correct cast is <const unsigned char*>, but your problem probably is in str content, not asn1 der format. Is your source certificate in der format?
Da: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org] Per conto di ikuzar Inviato: martedì 5 aprile 2011 02:05 A: openssl-users@openssl.org Oggetto: error:0D07209B:asn1 encoding routines:ASN1_get_object:too long Hello, I have got ths kind of error after running my program : error:0D07209B:asn1 encoding routines:ASN1_get_object:too long I code with c++, my constructor is like this : certificate(const char *str, size_t clen) { unsigned char const *u_str = reinterpret_cast< unsigned char const * >(str); X509* mycert = d2i_X509(NULL, &u_str, clen); .. } when I run my prog, I have got segmentation fault because mycert is NULL ( after debuging ). I think it is likely because of reinterpret_cast ... am I wrong? I cannot change the constructor's signature. ( cannot make certificate(unsigned const char *str, size_t clen ) . Is there another way to convert from const char *str to unsigned const char * ? I often meet this kind fo issue ( converting from const char *str to unsigned const char * u_str ) Thanks for your help.