Re: how can I use PKCS#8 in open-ssl?

2000-11-19 Thread Dr S N Henson

 
 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:
   

Yes that looks OK. The error is either due to an invalid password, a
corrupt key or one generated using a broken password algorithm.

Steve.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.
__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]



how can I use PKCS#8 in open-ssl?

2000-11-18 Thread



I will use an private keys whichencoding is 
PKCS#8.

Used open-ssl version is 0.95a ...

Is the usage belowvalid? if invalid, let meget 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...