diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/hazmat/backends/test_multibackend.py | 6 | ||||
-rw-r--r-- | tests/test_x509.py | 11 |
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/hazmat/backends/test_multibackend.py b/tests/hazmat/backends/test_multibackend.py index 319edf7d..7ffc4236 100644 --- a/tests/hazmat/backends/test_multibackend.py +++ b/tests/hazmat/backends/test_multibackend.py @@ -240,6 +240,9 @@ class DummyX509Backend(object): def create_x509_revoked_certificate(self, builder): pass + def x509_name_bytes(self, name): + pass + @utils.register_interface(ScryptBackend) class DummyScryptBackend(object): @@ -554,6 +557,7 @@ class TestMultiBackend(object): backend.create_x509_certificate(object(), b"privatekey", hashes.SHA1()) backend.create_x509_crl(object(), b"privatekey", hashes.SHA1()) backend.create_x509_revoked_certificate(object()) + backend.x509_name_bytes(object()) backend = MultiBackend([DummyBackend()]) with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_X509): @@ -580,6 +584,8 @@ class TestMultiBackend(object): ) with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_X509): backend.create_x509_revoked_certificate(object()) + with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_X509): + backend.x509_name_bytes(object()) def test_scrypt(self): backend = MultiBackend([DummyScryptBackend()]) diff --git a/tests/test_x509.py b/tests/test_x509.py index f375ac55..5d334242 100644 --- a/tests/test_x509.py +++ b/tests/test_x509.py @@ -3842,6 +3842,17 @@ class TestName(object): with pytest.raises(TypeError): x509.Name(["not-a-NameAttribute"]) + @pytest.mark.requires_backend_interface(interface=X509Backend) + def test_bytes(self, backend): + name = x509.Name([ + x509.NameAttribute(NameOID.COMMON_NAME, u'cryptography.io'), + x509.NameAttribute(NameOID.ORGANIZATION_NAME, u'PyCA'), + ]) + assert name.public_bytes(backend) == binascii.unhexlify( + b"30293118301606035504030c0f63727970746f6772617068792e696f310d300" + b"b060355040a0c0450794341" + ) + def test_random_serial_number(monkeypatch): sample_data = os.urandom(20) |