Skip to content

Instantly share code, notes, and snippets.

View liam-pat's full-sized avatar
📚
Focusing

liam liam-pat

📚
Focusing
  • Shota
  • Macao
  • 00:56 (UTC +08:00)
View GitHub Profile
# 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]