Hi all,
 
I have a strange problem with loading keys with PEM_ASN1_read function. The sample code is  as in sign.c sample looks like:
 
EVP_PKEY * ReadPublicKey_internal(const char *certfile) {
    FILE *fp = fopen (certfile, "r");  
    X509 *x509;
    EVP_PKEY *pkey;
   
    if (!fp)
        return NULL;
   
    x509 = (X509 *)PEM_ASN1_read ((char *(*)())d2i_X509,
        PEM_STRING_X509,
        fp, NULL, NULL, NULL);
    
    if (x509 == NULL) { 
//        ERR_print_errors_fp (stderr); // Not nessessery for use..
        return NULL;  
    }
   
    fclose (fp);
   
    pkey=X509_extract_key(x509);
    X509_free(x509);
   
//    if (pkey == NULL)
//        ERR_print_errors_fp (stderr);   
    return pkey;
}
 
 
This function fails on attempt to load key with 0x00000000 reading ;(
Something wrong? I guess in new version PEM_ASN1_read has additional parameter and nobody knows about contents.
 
Thanks,
Serge Batov

Reply via email to