clearhaus / aes256gcm_decrypt

Decrypt AES256GCM-encrypted data in Apple Pay Payment Tokens.
MIT License
10 stars 1 forks source link

Fix symbol issue by linking with lib crypto #1

Closed mt-clearhaus closed 6 years ago

mt-clearhaus commented 6 years ago

Now it works:

$ irb -r base64 -r ./lib/aes256gcm_decrypt.so
irb(main):001:0> token_data = Base64.decode64(File.read('test/token_data_base64.txt')); nil
irb(main):002:0> ciphertext = token_data[0..-17]; nil
irb(main):003:0> tag = token_data[-16..-1]; nil
irb(main):004:0> key = Base64.decode64(File.read('test/key_base64.txt')); nil
irb(main):005:0> puts Aes256GcmDecrypt::decrypt(ciphertext, tag, key)
{"applicationPrimaryAccountNumber":"4109370251004320","applicationExpirationDate":"200731","currencyCode":"840","transactionAmount":100,"deviceManufacturerIdentifier":"040010030273","paymentDataType":"3DSecure","paymentData":{"onlinePaymentCryptogram":"Af9x/QwAA/DjmU65oyc1MAABAAA=","eciIndicator":"5"}}