Hello!
I am unable to determine why I can't load private key using the following
code:

---------------------------------------------------------------------------------------------
  FILE* file = fopen(keyFile, "r");
  if(!file){
    fprintf(stderr, "Failed to open file %s.\n", keyFile);
    exit(1);
  }

 RSA* privKey = PEM_read_RSAPrivateKey(file, NULL,
(void*)default_get_password, "MyPassPhrase");
  fclose(file);
  if(privKey==NULL){
      fprintf(stderr, "Could load private key.\n");
      exit(1);
  }
---------------------------------------------------------------------------------------------

I always get that privKey is NULL however I pass correct file to read.
Here is a header of a private key :

---
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,FAD2CB55880FF15C
---

Can somebody suggest what I am doing wrong?

Thanks!
-Dima
-- 
View this message in context: 
http://www.nabble.com/PEM_read_RSAPrivateKey-returns-null-tp15434525p15434525.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to