Sample code for 30+ languages & platforms
CkPython

Example: Crypt2.GetSignedAttributes method

Demonstrates how to call the GetSignedAttributes method.

Chilkat CkPython Downloads

CkPython
import sys
import chilkat

success = False

crypt = chilkat.CkCrypt2()

bdPkcs7 = chilkat.CkBinData()
success = bdPkcs7.LoadFile("qa_data/cades/CAdES-T/Signature-C-T-1.p7m")
if (success == False):
    print(bdPkcs7.lastErrorText())
    sys.exit()

json = chilkat.CkJsonObject()
json.put_EmitCompact(False)

sbJson = chilkat.CkStringBuilder()
i = 0
tryNext = True
while tryNext :
    if (crypt.GetSignedAttributes(i,bdPkcs7,sbJson) == True):
        json.LoadSb(sbJson)
        print(str(i) + ": ")
        print(json.emit())
    else:
        tryNext = False

    i = i + 1

# Sample output:

# 0: 
# {
#   "signedAttributes": [
#     {
#       "oid": "1.2.840.113549.1.9.3",
#       "name": "Content Type"
#     },
#     {
#       "oid": "1.2.840.113549.1.9.5",
#       "name": "Signing Time"
#     },
#     {
#       "oid": "1.2.840.113549.1.9.4",
#       "name": "Message Digest"
#     },
#     {
#       "oid": "1.2.840.113549.1.9.16.2.47",
#       "name": "Signing Certificate V2"
#     }
#   ]
# }