Error outputting keys and certificates using an exported certificate with OpenSSL pkcs12
When a certificate is exported from Top Secret it can not be used with the pkcs12 command of OpenSSL.
Top Secret command to Export the certificate:
TSS EXPORT(user) DIGICERT(cert) -
DCDSN('dataset.PKCS12') -
FORMAT(PKCS12DER) -
PKCSPASS(password)
JCL to execute the pkcs12 command of OpenSSL
//*----------------------------------------------------------
//* Copy from MVS to USS the certificate PKCS12
//*----------------------------------------------------------
//COPY EXEC PGM=IKJEFT1B
//SYSOUT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *,SYMBOLS=EXECSYS
OPUT 'dataset.PKCS12' -
'/u/user/pkcs12.input' -
BINARY
/*
//OPENSSL EXEC PGM=BPXBATCH,REGION=0M
//STDOUT DD PATH='/u/user//stdout.openssl',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC)
//SYSPRINT DD SYSOUT=*
//CEEDUMP DD SYSOUT=*
//STDPARM DD *
sh cd ..;
openssl pkcs12
-in /u/user/pkcs12.input
-nodes
-info
-passin pass: password
openssl pkcs12
-export
-out /u/user/pkcs12.output
-nodes
-info
-passout pass:password
/*
The messages generated when the job is submitted are:
MAC Iteration 2000
MAC verified OK
PKCS7 Data
Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 2000
Error outputting keys and certificates
343598475400:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:./evp_enc.c:531:
343598475400:error:23077074:PKCS12 routines:PKCS12_pbe_crypt:pkcs12 cipherfinal error:./p12_decr.c:108:
343598475400:error:2306A075:PKCS12 routines:PKCS12_item_decrypt_d2i:pkcs12 pbe crypt error:./p12_decr.c:139:
Z/OS 2.4
Top secret 16.0
OpenSSL 1.0.21-dev
TSS 16 creates certificates at the TLS 1.3 level.
The command “openssl ciphers -v” to list ciphers has no reference to TLS 1.3
OpenSSL 1.0.21-dev does not support certificates created under TLS 1.3.
Upgrade OpenSSL to a version supporting TLS 1.3