If you are here you are likely either a developer working on a payment gateway, or you are a cryptography nut. In either case, welcome! I would be in the former category. Recently at work I found myself tasked with decrypting the Apple Pay blob you get from the Apple Pay on the Web flow, so we could use it to build 3D SecurePay messages to a payment processor (on behalf of one of our merchant customers).
I’ve done a lot of crypto over the years, so I didn’t think anything of this project. Turns out, there is little support in .NET for what Apple is doing!
I’m going to
Here’s Apple’s guide for decrypting the blob: Payment Token Format Reference
Sample code is available on GitHub.
Part 1: Verify the signature.
Part 2: Finding the
Part 3: Restore the symmetric key.
Part 4: Decrypt the data.
The sample code builds a .NET Core 3 WinForms app for running through all the steps covered in this series. If you want to get something up and running to quickly test your own blobs, it should do the job nicely.