Skip to content

Fix cryptography PKCS7_sign _x509 error with PKCS7SignatureBuilder #110

@reingart

Description

@reingart

Bump cryptography from 3.4.7 to 39.0.1, see dependabot ticket reingart#103
But, there are failures in the unit tests:

AttributeError: 'builtins.Certificate' object has no attribute '_x509'

The problem seems to be in wsaa.py line 144:

p7 = _lib.PKCS7_sign(cert._x509, private_key._evp_pkey, _ffi.NULL, bio_in, 0)

The new version of cryptography seems to have changed the signature methods: documentation:

p7 = pkcs7.PKCS7SignatureBuilder().set_data(
    b"data to sign"
).add_signer(
    cert, key, hashes.SHA256()
).sign(
    serialization.Encoding.SMIME, options
)
  • Ensure this fix work both for python2 and python3 workflows

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions