I am creating self signed certificates for my Java Web Application. My application uses Apache Tomcat and Apache HTTPD proxy. I was using OPENSSL 1.1.1 and Java keytool till now for self signed certificates and it works perfectly fine. But now I need to move to OpenSSL 3.1.1 and am facing issues.
Step1: Create a keystore
keytool -genkeypair -alias keystore -keyalg RSA -keystore C:\SSL\PVIStore -keysize 2048
Step2: Import keystore generated in step#1 to a .p12 file
keytool -importkeystore -srckeystore C:\SSL\PVIStore -destkeystore C:\SSL\PVIStore.p12 -deststoretype PKCS12
Step3: Get .crt file from file generated in step#2 using openssl 3.1.1
openssl pkcs12 -in C:\PVIStore.p12 -nokeys -out C:\SSL\PVIStore.crt
Step4: Get .key file from the file generated in step#2 using openssl 3.1.1
openssl pkcs12 -in C:\SSL\PVIStore.p12 -nocerts -nodes -out C:\SSL\PVIStore.key
Step #3 and Step #4 work perfectly fine in openssl 1.1.x but when using with openssl 3.1.1 I am getting below error:-
Error outputting keys and certificates 94210000:error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:crypto\evp\evp_fetch.c:341:Global default library context, Algorithm (RC2-40-CBC : 0), Properties ()
Note: I got a workaround to work for me by following another stackoverflow discussion, but I do not want to use the legacy switch to move ahead.
Any help is greatly appreciated.
Add the
-legacyoption to your OpenSSLpkcs12command line.See the man page which says this:
https://www.openssl.org/docs/man3.1/man1/openssl-pkcs12.html