N
N
NickNameNew2021-08-18 14:44:55
Python
NickNameNew, 2021-08-18 14:44:55

How to decrypt data received from GooglePay google_data?

I found documentation from Google, but there is paid content https://developers.google.com/pay/api/android/guid...

How to decrypt the payment method token
Complete the following steps:

Use the private key and ephemeralPublicKey to generate a 512-bit public key using the ECIES-KEM encryption scheme. Specify the following options:
elliptic curve - NIST P-256 (prime256v1 in OpenSSL);
CheckMode, OldCofactorMode, SingleHashMode, and CofactorMode values ​​are 0;
encoding function - uncompressed format;
key generation function - HKDF with SHA256; it is detailed in RFC 5869. Note that
you do not need to provide a salt (according to the RFC standard, the data array must be equivalent to a 32-byte zero-byte salt).
Split the generated key into two 256-bit keys: symmetricEncryptionKey and macKey.
Make sure the tag field contains a valid MAC value for the encryptedMessage.

To generate a MAC, use the HMAC algorithm (RFC 5869) with the SHA256 hash function and the macKey obtained in step 2.

Note. Use constant-time array comparison algorithms to avoid timing attacks.
Decrypt the encryptedMessage using the AES-256-CTR algorithm, given the following:

IV value zero;
no padding;
the symmetricEncryptionKey generated in step 2.


I read that I use the tink library from Google, but I did not find an example with decrypting google_data

Maybe someone faced such a problem, how to decrypt google_data from GooglePay?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question