aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2016-03-06 19:34:00 -0500
committerAlex Gaynor <alex.gaynor@gmail.com>2016-03-06 19:34:00 -0500
commit40087ae7bde2b2455491f98a33c7fef580284ee5 (patch)
treeb00ef56da8ef8272ac62fb6cb8dc5d80df45b197 /tests
parent1c6155a9aa47399ef17f23a169bc1233cec1bec3 (diff)
parent29affd2d9b50b892334447799eb0c351664b0250 (diff)
downloadcryptography-40087ae7bde2b2455491f98a33c7fef580284ee5.tar.gz
cryptography-40087ae7bde2b2455491f98a33c7fef580284ee5.tar.bz2
cryptography-40087ae7bde2b2455491f98a33c7fef580284ee5.zip
Merge pull request #2766 from reaperhulk/fix-2665
raise ValueError if > 2 byte value for NameAttribute with CN OID
Diffstat (limited to 'tests')
-rw-r--r--tests/test_x509.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_x509.py b/tests/test_x509.py
index 6145edb1..9054c4ed 100644
--- a/tests/test_x509.py
+++ b/tests/test_x509.py
@@ -3327,6 +3327,20 @@ class TestNameAttribute(object):
b'bytes'
)
+ def test_init_bad_country_code_value(self):
+ with pytest.raises(ValueError):
+ x509.NameAttribute(
+ NameOID.COUNTRY_NAME,
+ u'United States'
+ )
+
+ # unicode string of length 2, but > 2 bytes
+ with pytest.raises(ValueError):
+ x509.NameAttribute(
+ NameOID.COUNTRY_NAME,
+ u'\U0001F37A\U0001F37A'
+ )
+
def test_eq(self):
assert x509.NameAttribute(
x509.ObjectIdentifier('2.999.1'), u'value'