0

I want to do a Direct decryption using the Tink library but it says "cannot verify signature" I generated the key pair using the following "guide" https://developers.google.com/pay/api/web/guides/resources/payment-data-cryptography#public-key-format I registered the public key in the google pay & wallet console

also I implemented the snipplet in the page like this:

GooglePaymentsPublicKeysManager.INSTANCE_TEST.refreshInBackground();
String decryptedMessage =
new PaymentMethodTokenRecipient.Builder()
.fetchSenderVerifyingKeysWith(GooglePaymentsPublicKeysManager.INSTANCE_TEST)
.recipientId("merchant:MerchantId")
.protocolVersion("ECv2")
.addRecipientPrivateKey(privateKey)
.build()
.unseal(encryptedText);

but I'm getting this error:

java.security.GeneralSecurityException: cannot verify signature
 at com.google.crypto.tink.apps.paymentmethodtoken.PaymentMethodTokenRecipient.verify(PaymentMethodTokenRecipient.java:471)
 at com.google.crypto.tink.apps.paymentmethodtoken.PaymentMethodTokenRecipient.verifyIntermediateSigningKey(PaymentMethodTokenRecipient.java:545)
 at com.google.crypto.tink.apps.paymentmethodtoken.PaymentMethodTokenRecipient.verifyECV2(PaymentMethodTokenRecipient.java:411)
 at com.google.crypto.tink.apps.paymentmethodtoken.PaymentMethodTokenRecipient.unsealECV2(PaymentMethodTokenRecipient.java:375)
 at com.google.crypto.tink.apps.paymentmethodtoken.PaymentMethodTokenRecipient.unseal(PaymentMethodTokenRecipient.java:352)
 at com.test.googlepay.GooglepayApplication.main(GooglepayApplication.java:61)

I want a guide because I tried different approaches

asked Jan 9, 2025 at 16:06
1
  • Can you update the code and also share the encrypted message and also how your tokenizationSpecification looks like? Commented Jan 10, 2025 at 9:51

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.