x509.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # This file is dual licensed under the terms of the Apache License, Version
  2. # 2.0, and the BSD License. See the LICENSE file in the root of this repository
  3. # for complete details.
  4. import warnings
  5. from cryptography import utils, x509
  6. # This exists for pyOpenSSL compatibility and SHOULD NOT BE USED
  7. # WE WILL REMOVE THIS VERY SOON.
  8. def _Certificate(backend, x509) -> x509.Certificate: # noqa: N802
  9. warnings.warn(
  10. "This version of cryptography contains a temporary pyOpenSSL "
  11. "fallback path. Upgrade pyOpenSSL now.",
  12. utils.DeprecatedIn35,
  13. )
  14. return backend._ossl2cert(x509)
  15. # This exists for pyOpenSSL compatibility and SHOULD NOT BE USED
  16. # WE WILL REMOVE THIS VERY SOON.
  17. def _CertificateSigningRequest( # noqa: N802
  18. backend, x509_req
  19. ) -> x509.CertificateSigningRequest:
  20. warnings.warn(
  21. "This version of cryptography contains a temporary pyOpenSSL "
  22. "fallback path. Upgrade pyOpenSSL now.",
  23. utils.DeprecatedIn35,
  24. )
  25. return backend._ossl2csr(x509_req)
  26. # This exists for pyOpenSSL compatibility and SHOULD NOT BE USED
  27. # WE WILL REMOVE THIS VERY SOON.
  28. def _CertificateRevocationList( # noqa: N802
  29. backend, x509_crl
  30. ) -> x509.CertificateRevocationList:
  31. warnings.warn(
  32. "This version of cryptography contains a temporary pyOpenSSL "
  33. "fallback path. Upgrade pyOpenSSL now.",
  34. utils.DeprecatedIn35,
  35. )
  36. return backend._ossl2crl(x509_crl)