I will use an private keys which encoding is PKCS#8.
 
Used open-ssl version is 0.95a ...
 
Is the usage below valid? if invalid, let me get the write usage please..
 
 FILE* fp;
 EVP_PKEY* pkey;
 char keyfile[]  = "user1.pem";

 fp = fopen (keyfile, "r");
 if (fp == NULL) return -2;
 
 pkey = PEM_read_PrivateKey(fp, NULL, NULL, NULL);
 
 if (pkey == NULL) {
  ERR_print_errors_fp (stderr);
  return -2;
 }
   fclose (fp);
The result is :
Enter PEM pass phrase:
1564:error:06065064:digital envelope routines:EVP_DecryptFinal:bad decrypt:d:\work\evp_enc.c:243:
1564:error:23077074:PKCS12 routines:PKCS12_pbe_crypt:pkcs12 cipherfinal error:D:\work\p12_decr.c:95:
1564:error:2306A075:PKCS12 routines:PKCS12_decrypt_d2i:pkcs12 pbe crypt error:D:\work\p12_decr.c:121:
1564:error:0906700D:PEM routines:PEM_ASN1_read_bio:ASN1 lib:d:\work\pem_lib.c:290:
 
Thanks for reading...

Reply via email to