NSS error -8178 SEC_ERROR_BAD_KEY
fazlul3003 opened this issue · 6 comments
This has to do with the fact that by default cURL is not compiled with OpenSSL. To fix this, after you've created you private key .pem file via this command:
openssl pkcs12 -in ApplePayMerchantIdentity_and_privatekey.p12 -out ApplePay.key.pem -nocerts
Take the file that was output and run this command:
openssl rsa -in ApplePay.key.pem-out ApplePay.RSA.key.pem
This will format the key to RSA format, which will work for your application. Reference this new file via:
define('PRODUCTION_CERTIFICATE_KEY', '/your/path/to/applepay_includes/ApplePay.RSA.key.pem');
and you should be good to go
Unable to convert PEM to RSA using
openssl rsa -in ApplePay.key.pem-out ApplePay.RSA.key.pem
140735700853704:error:0607907F:digital envelope routines:EVP_PKEY_get1_RSA:expecting an rsa key:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-22.50.2/libressl/crypto/evp/p_lib.c:297:
could not load PEM client certificate, OpenSSL error error:0909006C:PEM routines:get_name:no start line, (no key found, wrong pass phrase, or wrong file format?)
@PeraDev7 I'm having same issue. Please share the solution if you find it. thanks!
use this one
openssl rsa -in ApplePay.key.pem -out ApplePay.RSA.key.pem
Unable to convert PEM to RSA using openssl rsa -in ApplePay.key.pem-out ApplePay.RSA.key.pem
140735700853704:error:0607907F:digital envelope routines:EVP_PKEY_get1_RSA:expecting an rsa key:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-22.50.2/libressl/crypto/evp/p_lib.c:297:
I also encountered the same error, please let me know if you solved