Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSS error -8178 SEC_ERROR_BAD_KEY #7

Open
fazlul3003 opened this issue Jul 9, 2018 · 6 comments
Open

NSS error -8178 SEC_ERROR_BAD_KEY #7

fazlul3003 opened this issue Jul 9, 2018 · 6 comments

Comments

@fazlul3003
Copy link

fazlul3003 commented Jul 9, 2018

After all I setup, when I test the curl_test.php file I'm getting following error:

curl

I even tried disabling the SSL in curl by adding:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

Any idea what casing the error?

@fazlul3003 fazlul3003 changed the title NSS - SEC_ERROR_BAD_KEY NSS error -8178 SEC_ERROR_BAD_KEY Jul 9, 2018
@michalzaptk
Copy link

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

@Blendlight
Copy link

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:

@PeraDev7
Copy link

PeraDev7 commented Mar 4, 2021

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?)

@abdullah1212
Copy link

@PeraDev7 I'm having same issue. Please share the solution if you find it. thanks!

@Babis86
Copy link

Babis86 commented Feb 2, 2022

use this one
openssl rsa -in ApplePay.key.pem -out ApplePay.RSA.key.pem

@Kishore-gmp
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants