Payment: Receiving receipts problem

I'm getting the following exception:

java.lang.RuntimeException: javax.crypto.BadPaddingException: unknown block type

in the line:

receipts = helper.decryptReceiptResponse(response, mPublicKey);

The mPublicKey is successfully generated and set. Do you have any ideas or tips where I can start to overcome this issue?

Comments

  • stolkstolk Posts: 119Member

    The mPublicKey is successfully generated and set. Do you have any ideas or tips where I can start to overcome this issue?
    Do you encrypt your purchase request with something like this?

    Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding", "BC");
    cipher.init(Cipher.ENCRYPT_MODE, key, iv);
    byte[] payload = cipher.doFinal(purchaseRequestJson.getBytes("UTF-8"));

    cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding", "BC");
    cipher.init(Cipher.ENCRYPT_MODE, publicKey);
    byte[] encryptedKey = cipher.doFinal(keyBytes);
  • IntermediawareIntermediaware Posts: 7Member
    Sorry,

    During debugging I just found out that I used the wrong key-file. Now everything works fine.
Sign In or Register to comment.