opensslprivate-keyp12

OpenSSL - Failed to create p12 from private key on bad decrypt


I installed OpenSSL 1.1.1 on windows https://kb.firedaemon.com/support/solutions/articles/4000121705#Download-OpenSSL

I got crt file and I have PrivKey.pem created and I try to generate p12

openssl pkcs12 -export -in Cert.crt -inkey PrivKey.pem -out KeyStore.p12

Output:

unable to load private key
18328:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:..\crypto\evp\evp_enc.c:615:
18328:error:0906A065:PEM routines:PEM_do_header:bad decrypt:..\crypto\pem\pem_lib.c:461:

I notice that when I create private key I don't get password prompt

openssl genrsa -aes256 -out PrivKey.pem 2048

Output:

Generating RSA private key, 2048 bit long modulus (2 primes)

Most related answers I found related to wrong configuration/file, but it seems as a different case

Should I reset my settings and renew process?


Solution

  • I download and install OpenSSL 1.1.1 for Linux and it works without any issue