CyberSource / cybersource-sdk-java

Java SDK for CyberSource Simple Order API
Other
51 stars 84 forks source link

Exception while obtaining private key from KeyStore with alias, 'MYALIAS' #151

Closed AdrianCroft-powerschool closed 3 years ago

AdrianCroft-powerschool commented 3 years ago

I just generated a new keystore from the Cybersource test site ( https://ebc2test.cybersource.com/ebc2/ ) - in trying to use it with my existing, working code I'm receiving the error:

com.cybersource.ws.client.ClientException: Exception while obtaining private key from KeyStore with alias, 'MYALIAS'

If I inspect the keystore using keytool I get the following information:


Keystore type: PKCS12 Keystore provider: SunJSSE

Your keystore contains 1 entry

Alias name: 1 Creation date: Dec 2, 2020 Entry type: PrivateKeyEntry Certificate chain length: 2 Certificate[1]: Owner: SERIALNUMBER=1111111111111111111111111, CN=MYALIAS Issuer: CN=CyberSourceCertAuth Serial number: 2222222222222222222222222222222222222222222222 Valid from: Wed Dec 02 13:47:52 MST 2020 until: Fri Dec 02 13:47:52 MST 2022 Certificate fingerprints: MD5: XXX SHA1: XXX SHA256: XXX Signature algorithm name: SHA256withRSA Subject Public Key Algorithm: 2048-bit RSA key Version: 3 Certificate[2]: Owner: CN=CyberSourceCertAuth Issuer: CN=CyberSourceCertAuth Serial number: 1111111111111111111111111111111111111111111 Valid from: Wed Jan 18 09:37:02 MST 2012 until: Tue Jan 18 09:37:02 MST 2022 Certificate fingerprints: MD5: XXX SHA1: XXX SHA256: XXX Signature algorithm name: SHA1withRSA Subject Public Key Algorithm: 1024-bit RSA key Version: 3


It SEEMS that the code is looking for a certificate with the name "CyberSourceCertAuth" but since it is the second one in the list here the code errors out before reaching it.

Strangely if I inspect previously generated keystores that have been working in production I get this returned:


Keystore type: PKCS12 Keystore provider: SunJSSE

Your keystore contains 0 entries


It looks like cybersource has changed the way that it is creating the keystore files and I'm wondering if this SDK is not supporting the new files.

Any help is appreciated.

mahendya1002 commented 3 years ago

Could you please generate the new key and see if it works ?

AdrianCroft-powerschool commented 3 years ago

@mahendya1002 I generated a new key and it seemed to work this time. Thank you.

brianmc commented 3 years ago

Thanks @mahendya1002 and thanks @AdrianCroft-powerschool for letting us know.