Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Replace PyOpenSSL with PyCA Crytography #501

@tiran

Description

@tiran

fedmsg uses PyCA cryptography and PyOpenSSL's OpenSSL.crypto module. Please consider to use only PyCA cryptography.

https://pyopenssl.readthedocs.io/en/stable/api/crypto.html

pyca/cryptography is likely a better choice than using this module. It contains a complete set of cryptographic primitives as well as a significantly better and more powerful X509 API. If necessary you can convert to and from cryptography objects using the to_cryptography and from_cryptography methods on X509, X509Req, CRL, and PKey.

PyOpenSSL is used in fedmsg.crypto.x509_ng:

try:
# We require cryptography 1.6+ and pyOpenSSL 16.1+
#
# Until cryptography can do full chain certificate validation
# (https://github.com/pyca/cryptography/issues/2381) we need to use
# pyOpenSSL. However, pyOpenSSL is not meant to be a long-term solution
# since the ultimate goal is for it to be obsoleted:
# https://mail.python.org/pipermail/cryptography-dev/2017-June/000774.html
from cryptography import x509
from cryptography.exceptions import InvalidSignature
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import asymmetric, hashes, serialization
from OpenSSL.crypto import (X509Store, X509StoreContext, X509StoreContextError,
load_certificate, load_crl, FILETYPE_PEM, X509StoreFlags)
_cryptography = True

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions