aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_x509.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-10-27 09:35:17 +0900
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-10-27 09:35:17 +0900
commit8b5d094ca3bb5cafa61001b83c1798e40af37223 (patch)
tree0c9c64aecf999e8d4d92ac2b72dd7f22fdcd3265 /tests/test_x509.py
parent5a2bb54bbb7b68a7407ab5d62c828c329166bd81 (diff)
downloadcryptography-8b5d094ca3bb5cafa61001b83c1798e40af37223.tar.gz
cryptography-8b5d094ca3bb5cafa61001b83c1798e40af37223.tar.bz2
cryptography-8b5d094ca3bb5cafa61001b83c1798e40af37223.zip
switch to using pyasn1_modules for the test
Diffstat (limited to 'tests/test_x509.py')
-rw-r--r--tests/test_x509.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/test_x509.py b/tests/test_x509.py
index 1fa4d82a..79424752 100644
--- a/tests/test_x509.py
+++ b/tests/test_x509.py
@@ -9,7 +9,9 @@ import datetime
import ipaddress
import os
-from asn1crypto import core, x509 as asn1cryptox509
+from pyasn1.codec.der import decoder
+
+from pyasn1_modules import rfc2459
import pytest
@@ -861,17 +863,17 @@ class TestRSACertificateRequest(object):
cert = builder.sign(issuer_private_key, hashes.SHA256(), backend)
- parsedasn1 = asn1cryptox509.Certificate.load(
- cert.public_bytes(serialization.Encoding.DER)
- )
- assert isinstance(
- parsedasn1.subject.chosen[0][0]['value'].chosen,
- core.PrintableString
- )
- assert isinstance(
- parsedasn1.subject.chosen[1][0]['value'].chosen,
- core.UTF8String
- )
+ parsed, _ = decoder.decode(
+ cert.public_bytes(serialization.Encoding.DER),
+ asn1Spec=rfc2459.Certificate()
+ )
+ tbs_cert = parsed.getComponentByName('tbsCertificate')
+ subject = tbs_cert.getComponentByName('subject')
+ issuer = tbs_cert.getComponentByName('issuer')
+ # \x13 is printable string. The first byte of the value of the
+ # node corresponds to the ASN.1 string type.
+ assert str(subject[0][0][0][1])[0] == "\x13"
+ assert str(issuer[0][0][0][1])[0] == "\x13"
class TestCertificateBuilder(object):