public static class PaymentMethodTokenRecipient.Builder extends Object
PaymentMethodTokenRecipient.| Constructor and Description |
|---|
Builder() |
@CanIgnoreReturnValue public PaymentMethodTokenRecipient.Builder protocolVersion(String val)
@CanIgnoreReturnValue public PaymentMethodTokenRecipient.Builder senderId(String val)
@CanIgnoreReturnValue public PaymentMethodTokenRecipient.Builder recipientId(String val)
@CanIgnoreReturnValue public PaymentMethodTokenRecipient.Builder fetchSenderVerifyingKeysWith(GooglePaymentsPublicKeysManager googlePaymentsPublicKeysManager) throws GeneralSecurityException
GooglePaymentsPublicKeysManager.
This is the preferred method of specifying the verifying public keys of the sender.
GeneralSecurityException@CanIgnoreReturnValue public PaymentMethodTokenRecipient.Builder senderVerifyingKeys(String trustedSigningKeysJson) throws GeneralSecurityException
IMPORTANT: Instead of using this method to set the verifying public keys of the
sender, prefer calling fetchSenderVerifyingKeysWith(com.google.crypto.tink.apps.paymentmethodtoken.GooglePaymentsPublicKeysManager) passing it an instance of GooglePaymentsPublicKeysManager. It will take care of fetching fresh keys and caching in
memory. Only use this method if you can't use fetchSenderVerifyingKeysWith(com.google.crypto.tink.apps.paymentmethodtoken.GooglePaymentsPublicKeysManager) and be
aware you will need to handle Google key rotations yourself.
The given string is a JSON object formatted like the following:
{
"keys": [
{
"keyValue": "encoded public key",
"protocolVersion": "ECv1"
},
{
"keyValue": "encoded public key",
"protocolVersion": "ECv1"
},
],
}
Each public key will be a base64 (no wrapping, padded) version of the key encoded in ASN.1 type SubjectPublicKeyInfo defined in the X.509 standard.
GeneralSecurityException@CanIgnoreReturnValue public PaymentMethodTokenRecipient.Builder addSenderVerifyingKey(String val) throws GeneralSecurityException
IMPORTANT: Instead of using this method to set the verifying public keys of the
sender, prefer calling fetchSenderVerifyingKeysWith(com.google.crypto.tink.apps.paymentmethodtoken.GooglePaymentsPublicKeysManager) passing it an instance of GooglePaymentsPublicKeysManager. It will take care of fetching fresh keys and caching in
memory. Only use this method if you can't use fetchSenderVerifyingKeysWith(com.google.crypto.tink.apps.paymentmethodtoken.GooglePaymentsPublicKeysManager) and be
aware you will need to handle Google key rotations yourself.
The public key is a base64 (no wrapping, padded) version of the key encoded in ASN.1 type SubjectPublicKeyInfo defined in the X.509 standard.
Multiple keys may be added. This utility will then verify any message signed with any of the private keys corresponding to the public keys added. Adding multiple keys is useful for handling key rotation.
GeneralSecurityException@CanIgnoreReturnValue public PaymentMethodTokenRecipient.Builder addSenderVerifyingKey(ECPublicKey val) throws GeneralSecurityException
IMPORTANT: Instead of using this method to set the verifying public keys of the
sender, prefer calling fetchSenderVerifyingKeysWith(com.google.crypto.tink.apps.paymentmethodtoken.GooglePaymentsPublicKeysManager) passing it an instance of GooglePaymentsPublicKeysManager. It will take care of fetching fresh keys and caching in
memory. Only use this method if you can't use fetchSenderVerifyingKeysWith(com.google.crypto.tink.apps.paymentmethodtoken.GooglePaymentsPublicKeysManager) and be
aware you will need to handle Google key rotations yourself.
GeneralSecurityException@CanIgnoreReturnValue public PaymentMethodTokenRecipient.Builder addRecipientPrivateKey(String val) throws GeneralSecurityException
It must be base64 encoded PKCS8 private key.
GeneralSecurityException@CanIgnoreReturnValue public PaymentMethodTokenRecipient.Builder addRecipientPrivateKey(ECPrivateKey val) throws GeneralSecurityException
GeneralSecurityException@CanIgnoreReturnValue public PaymentMethodTokenRecipient.Builder addRecipientKem(PaymentMethodTokenRecipientKem kem)
PaymentMethodTokenRecipientKem.
This is useful for clients that store keys in an HSM and need a more control on how the
key is used. If you are not using an HSM, you probably should just use addRecipientPrivateKey(java.lang.String).
public PaymentMethodTokenRecipient build() throws GeneralSecurityException
GeneralSecurityException