beatty / applepay_crypto_demo

108 stars 18 forks source link

ECKeyAgreement requires ECPrivateKey #2

Closed asafmaoz1234 closed 9 years ago

asafmaoz1234 commented 9 years ago

Seems like the conversion to ECPrivateKey does not work, the var type is ECPrivateKey but still throws this exception on: public static byte[] decrypt(... keyAgreement.init(merchantPrivateKey);

Exception in thread "main" java.security.InvalidKeyException: ECKeyAgreement requires ECPrivateKey at org.bouncycastle.jce.provider.JCEECDHKeyAgreement.engineInit(Unknown Source) at javax.crypto.KeyAgreement.init(KeyAgreement.java:461) at javax.crypto.KeyAgreement.init(KeyAgreement.java:435) at com.johndbeatty.applepay.Main.decrypt(Main.java:113) at com.johndbeatty.applepay.Main.main(Main.java:104)

Any idea how to fix?

asafmaoz1234 commented 9 years ago

Nevermind. solved it.

Cris464 commented 9 years ago

can you please tell me what is the solution. I am facing the same problem.

RMMJP1 commented 8 years ago

I am getting same error can some one please let know how to solve it.