While working with the new asn1 library to implement the CMS format i missed one integration between the asn1 module and the x509.* classes. It would be nice if something like the following could work.
@asn1.sequence
class Test:
cert: x509.Certificate
To include the Certificate, CSR or CRL objects that cryptography already has in the structure, without complexity. Currently the only option would be to do someting like:
_cert = load_pem_certificate(...)
@asn1.sequence
class Test:
cert: asn1.TLV
# Create object
obj = Test(cert=asn1.TLV(
_cert.public_bytes(encoding=Encoding.DER)
))
# Get cert from object
_cert_from_obj = load_der_certificate(obj.cert)
And i am not even sure if this would work. But nevertheless it is not a nice solution.
While working with the new asn1 library to implement the CMS format i missed one integration between the asn1 module and the x509.* classes. It would be nice if something like the following could work.
To include the Certificate, CSR or CRL objects that cryptography already has in the structure, without complexity. Currently the only option would be to do someting like:
And i am not even sure if this would work. But nevertheless it is not a nice solution.