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
-
Can you update the code and also share the encrypted message and also how your tokenizationSpecification looks like?Domi– Domi2025年01月10日 09:51:31 +00:00Commented Jan 10, 2025 at 9:51
lang-java