The subtype SignedData CADES , CMS or PKCS # 7 1.5 the signature has a collection of SignerInfo blocks specified here , it contains mainly:
- SignerIdentifier: key to the certificate collection
- DigestAlgorithmIdentifier: which algorithm was used to calculate the message digest
- SignedAttributes (optional): sealed data:
- SignatureAlgorithmIdentifier: which algorithm was used to calculate the signature (above SignedAttributes)
- SignatureValue: Signature Value
- UnsignedAttributes (optional)
SignedAttributes may contain, depending on the type of signature:
- ContentType: type of signed content
- Messagedigest
- SigningTime
- countersignatures
If we simplified this by using only the first signature found and using my pyx509 plug it could be some type of code like this (not tested):
from pyx509.models import PKCS7 pkcs7 = PKCS7.from_der(here_goes_your_pks7_signature_data_der_encoded) signer_info = pkcs7.content.signerInfos[0] auth_attrs = signer_info.auth_attributes for attr in auth_attrs.attributes: if attr.type == '1.2.840.113549.1.9.4':
source share