aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-08-08 10:32:03 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-08-08 10:32:03 -0500
commit0777325061deb2773e74dfe242d5150d0ce8b378 (patch)
tree0566905f895d40560eed5358ae346bf818eb0e42 /src
parentd298484f44929f85ac7951ded5270911df11f6c3 (diff)
downloadcryptography-0777325061deb2773e74dfe242d5150d0ce8b378.tar.gz
cryptography-0777325061deb2773e74dfe242d5150d0ce8b378.tar.bz2
cryptography-0777325061deb2773e74dfe242d5150d0ce8b378.zip
move distpoint fullname/relativename to consts in backends.openssl.x509
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/backend.py8
-rw-r--r--src/cryptography/hazmat/backends/openssl/x509.py6
2 files changed, 9 insertions, 5 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py
index 7f90bd8f..2752d98d 100644
--- a/src/cryptography/hazmat/backends/openssl/backend.py
+++ b/src/cryptography/hazmat/backends/openssl/backend.py
@@ -38,7 +38,8 @@ from cryptography.hazmat.backends.openssl.rsa import (
_RSAPrivateKey, _RSAPublicKey
)
from cryptography.hazmat.backends.openssl.x509 import (
- _Certificate, _CertificateSigningRequest
+ _Certificate, _CertificateSigningRequest, _DISTPOINT_TYPE_FULLNAME,
+ _DISTPOINT_TYPE_RELATIVENAME
)
from cryptography.hazmat.bindings.openssl.binding import Binding
from cryptography.hazmat.primitives import hashes, serialization
@@ -391,15 +392,14 @@ def _encode_crl_distribution_points(backend, crl_distribution_points):
if point.full_name:
dpn = backend._lib.DIST_POINT_NAME_new()
assert dpn != backend._ffi.NULL
- # Type 0 is fullName, there is no #define for it in the code.
- dpn.type = 0
+ dpn.type = _DISTPOINT_TYPE_FULLNAME
dpn.name.fullname = _encode_general_names(backend, point.full_name)
dp.distpoint = dpn
if point.relative_name:
dpn = backend._lib.DIST_POINT_NAME_new()
assert dpn != backend._ffi.NULL
- dpn.type = 1
+ dpn.type = _DISTPOINT_TYPE_RELATIVENAME
name = _encode_name_gc(backend, point.relative_name)
relativename = backend._lib.sk_X509_NAME_ENTRY_dup(name.entries)
assert relativename != backend._ffi.NULL
diff --git a/src/cryptography/hazmat/backends/openssl/x509.py b/src/cryptography/hazmat/backends/openssl/x509.py
index ee9a3bbf..564b2680 100644
--- a/src/cryptography/hazmat/backends/openssl/x509.py
+++ b/src/cryptography/hazmat/backends/openssl/x509.py
@@ -592,6 +592,10 @@ def _decode_extended_key_usage(backend, sk):
return x509.ExtendedKeyUsage(ekus)
+_DISTPOINT_TYPE_FULLNAME = 0
+_DISTPOINT_TYPE_RELATIVENAME = 1
+
+
def _decode_crl_distribution_points(backend, cdps):
cdps = backend._ffi.cast("Cryptography_STACK_OF_DIST_POINT *", cdps)
cdps = backend._ffi.gc(cdps, backend._lib.sk_DIST_POINT_free)
@@ -651,7 +655,7 @@ def _decode_crl_distribution_points(backend, cdps):
# point so make sure it's not null.
if cdp.distpoint != backend._ffi.NULL:
# Type 0 is fullName, there is no #define for it in the code.
- if cdp.distpoint.type == 0:
+ if cdp.distpoint.type == _DISTPOINT_TYPE_FULLNAME:
full_name = _decode_general_names(
backend, cdp.distpoint.name.fullname
)