I am working on adapting our PKI toolkit to use OpenSSL.  We of course
have our own internal format for storing private keys.  My problem is
this, I export our private key in a ASN.1 DER encoded format and then
try to "import" it with d2i_RSAPrivateKey().  No luck, the function is
failing and returning a NULL.  It is specifically dying within :

RSA *d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length)
 {
 int i=ASN1_R_PARSING;
 ASN1_INTEGER *bs=NULL;
 M_ASN1_D2I_vars(a,RSA *,RSA_new);

 M_ASN1_D2I_Init();
 M_ASN1_D2I_start_sequence();
 M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
 if (bs->length == 0)
  ret->version=0;
 else ret->version=bs->data[0];
 M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);  // dying here

Reply via email to