aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/primitives/test_asym_utils.py3
-rw-r--r--tests/test_x509.py21
2 files changed, 8 insertions, 16 deletions
diff --git a/tests/hazmat/primitives/test_asym_utils.py b/tests/hazmat/primitives/test_asym_utils.py
index bd1fa35e..4835f091 100644
--- a/tests/hazmat/primitives/test_asym_utils.py
+++ b/tests/hazmat/primitives/test_asym_utils.py
@@ -73,8 +73,7 @@ def test_decode_dss_invalid_asn1():
decode_dss_signature(b"0\x07\x02\x01\x01\x02\x02\x01")
with pytest.raises(ValueError):
- # This is the BER "end-of-contents octets," which older versions of
- # pyasn1 are wrongly willing to return from top-level DER decoding.
+ # This is the BER "end-of-contents octets".
decode_dss_signature(b"\x00\x00")
diff --git a/tests/test_x509.py b/tests/test_x509.py
index 1ecf6b6a..db26f563 100644
--- a/tests/test_x509.py
+++ b/tests/test_x509.py
@@ -11,9 +11,7 @@ import os
import sys
import warnings
-from pyasn1.codec.der import decoder
-
-from pyasn1_modules import rfc2459
+from asn1crypto.x509 import Certificate
import pytest
@@ -1458,17 +1456,12 @@ class TestRSACertificateRequest(object):
cert = builder.sign(issuer_private_key, hashes.SHA256(), backend)
- 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 subject[0][0][0][1][0] == b"\x13"[0]
- assert issuer[0][0][0][1][0] == b"\x13"[0]
+ parsed = Certificate.load(
+ cert.public_bytes(serialization.Encoding.DER))
+
+ # Check that each value was encoded as an ASN.1 PRINTABLESTRING.
+ assert parsed.subject.chosen[0][0]['value'].chosen.tag == 19
+ assert parsed.issuer.chosen[0][0]['value'].chosen.tag == 19
class TestCertificateBuilder(object):