aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-08-05 17:30:39 +0100
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-08-08 14:58:07 -0500
commit253929a85c45c1313fd68d10ec7a7a45e380d5c0 (patch)
tree8e52c5b3e93d053319a0658dae32026cf39bd050 /tests
parentd5bf17ad99939920aa73e6d00a36818ecaf1c2cc (diff)
downloadcryptography-253929a85c45c1313fd68d10ec7a7a45e380d5c0.tar.gz
cryptography-253929a85c45c1313fd68d10ec7a7a45e380d5c0.tar.bz2
cryptography-253929a85c45c1313fd68d10ec7a7a45e380d5c0.zip
add AuthorityKeyIdentifier from_issuer_public_key
Refactored SKI's creation code into a separate function, added doctest examples
Diffstat (limited to 'tests')
-rw-r--r--tests/test_x509_ext.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py
index 73cdfc5f..40231b93 100644
--- a/tests/test_x509_ext.py
+++ b/tests/test_x509_ext.py
@@ -2112,6 +2112,25 @@ class TestAuthorityKeyIdentifierExtension(object):
]
assert ext.value.authority_cert_serial_number == 3
+ def test_from_certificate(self, backend):
+ issuer_cert = _load_cert(
+ os.path.join("x509", "rapidssl_sha256_ca_g3.pem"),
+ x509.load_pem_x509_certificate,
+ backend
+ )
+ cert = _load_cert(
+ os.path.join("x509", "cryptography.io.pem"),
+ x509.load_pem_x509_certificate,
+ backend
+ )
+ ext = cert.extensions.get_extension_for_oid(
+ x509.OID_AUTHORITY_KEY_IDENTIFIER
+ )
+ aki = x509.AuthorityKeyIdentifier.from_issuer_public_key(
+ issuer_cert.public_key()
+ )
+ assert ext.value == aki
+
class TestNameConstraints(object):
def test_ipaddress_wrong_type(self):