This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load the contents of the receipt file | |
receipt_file = open('./receipt_data.bin', 'rb').read() | |
# Use asn1crypto's cms definitions to parse the PKCS#7 format | |
from asn1crypto.cms import ContentInfo | |
pkcs_container = ContentInfo.load(receipt_file) | |
# Extract the certificates, signature, and receipt_data | |
certificates = pkcs_container['content']['certificates'] | |
signer_info = pkcs_container['content']['signer_infos'][0] |