Google Pay Direct Integration Rotation of keys

278 views Asked by At

I am trying to implement the Google Pay using direct integration and in the google docs it is mentioned that merchants have to manually rotate the keys. During rotation it is mentioned that Caution: You must support the old private key for decryption of payment methods for eight days after you remove the old public key.

Does this mean I need to support old private key even after deleting the old public key?

I found out that Google uses Elliptic Curve Digital Signature which is asymmetric. As far as I know in case of asymmetric algorithms only one key pair will be involved (public and private). Why does Google recommend to support old private key up to 8 days?

1

There are 1 answers

2
Beppe C On

The workflow is the following:

  • define/upload a new key pair (recommended annually)

  • support both new and old keys during decryption

     String decryptedMessage =
      new PaymentMethodTokenRecipient.Builder()
         .addRecipientPrivateKey(newPrivateKey)
         .addRecipientPrivateKey(oldPrivateKey);
    
  • remove old key

This is a common approach as the platform might require some time to propagate the new keys and make sure the old ones are no longer used. You need to support the old key deploying the code above (supporting both signatures) for some time (at least 8 days according to Google's note) and ideally

confirm that the old public key is no longer used to encrypt any transactions.