summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2021-10-30 17:10:26 -0400
committerGitHub <noreply@github.com>2021-10-31 05:10:26 +0800
commit2336005c518692164fcf7cdc5ea1c61ba35b8434 (patch)
tree7315701d084c8d9eec6ee6c61958200f2fae3d61 /tests
parent6bb47a420b6d057723d3e9bac2ccb2aa715a0eae (diff)
downloadcryptography-2336005c518692164fcf7cdc5ea1c61ba35b8434.tar.gz
Convert CSR creation to Rust (#6495)
* Convert CSR creation to Rust * put this back * unused * coverage
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/backends/test_openssl.py12
-rw-r--r--tests/x509/test_x509.py14
2 files changed, 14 insertions, 12 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index f2233329d..234c3b052 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -472,18 +472,6 @@ class TestOpenSSLCMAC(object):
backend.create_cmac_ctx(DummyCipherAlgorithm())
-class TestOpenSSLSignX509CSR(object):
- def test_requires_csr_builder(self):
- private_key = RSA_KEY_2048.private_key(backend)
-
- with pytest.raises(TypeError):
- backend.create_x509_csr(
- object(), # type: ignore[arg-type]
- private_key,
- DummyHashAlgorithm(),
- )
-
-
class TestOpenSSLSignX509CertificateRevocationList(object):
def test_invalid_builder(self):
private_key = RSA_KEY_2048.private_key(backend)
diff --git a/tests/x509/test_x509.py b/tests/x509/test_x509.py
index 5d0b4cb3e..5d6c7d921 100644
--- a/tests/x509/test_x509.py
+++ b/tests/x509/test_x509.py
@@ -4046,6 +4046,20 @@ class TestCertificateSigningRequestBuilder(object):
== locality
)
+ def test_add_attributes_non_utf8(self, backend):
+ _skip_curve_unsupported(backend, ec.SECP256R1())
+ private_key = ec.generate_private_key(ec.SECP256R1(), backend)
+ builder = (
+ x509.CertificateSigningRequestBuilder()
+ .subject_name(x509.Name([]))
+ .add_attribute(
+ x509.oid.AttributeOID.CHALLENGE_PASSWORD,
+ b"\xbb\xad\x16\x9a\xac\xc9\x03i\xec\xcc\xdd6\xcbh\xfc\xf3",
+ )
+ )
+ with pytest.raises(ValueError):
+ builder.sign(private_key, hashes.SHA256(), backend)
+
def test_add_attribute_bad_types(self, backend):
request = x509.CertificateSigningRequestBuilder()
with pytest.raises(TypeError):