diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2017-09-14 04:24:30 +0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2017-09-13 16:24:30 -0400 |
commit | 979c26303fbd6a2f4044855d989f4a74a4d51ac5 (patch) | |
tree | 1aae87422896b36a11a34f1f4ffe08e583e62edc /tests/x509/test_x509_ext.py | |
parent | bdad051b9987951b4838e5c3458f6ba38b4e2ccf (diff) | |
download | cryptography-979c26303fbd6a2f4044855d989f4a74a4d51ac5.tar.gz cryptography-979c26303fbd6a2f4044855d989f4a74a4d51ac5.tar.bz2 cryptography-979c26303fbd6a2f4044855d989f4a74a4d51ac5.zip |
add aki hash (#3910)
* Implement __hash__ on AuthorityKeyIdentifier
* Adding dirname to fix build issue on AuthorityKeyIdentifier test
* .authority_cert_issuer to str
* use a tuple and not a str repr
Diffstat (limited to 'tests/x509/test_x509_ext.py')
-rw-r--r-- | tests/x509/test_x509_ext.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py index 6010e77d..22b4cc5b 100644 --- a/tests/x509/test_x509_ext.py +++ b/tests/x509/test_x509_ext.py @@ -907,7 +907,6 @@ class TestSubjectKeyIdentifier(object): ski3 = x509.SubjectKeyIdentifier( binascii.unhexlify(b"aa8098456f6ff7ff3ac9092384932230498bc980") ) - assert hash(ski1) == hash(ski2) assert hash(ski1) != hash(ski3) @@ -1025,6 +1024,16 @@ class TestAuthorityKeyIdentifier(object): assert aki != aki5 assert aki != object() + def test_hash(self): + dirname = x509.DirectoryName( + x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, u'myCN')]) + ) + aki1 = x509.AuthorityKeyIdentifier(b"digest", [dirname], 1234) + aki2 = x509.AuthorityKeyIdentifier(b"digest", [dirname], 1234) + aki3 = x509.AuthorityKeyIdentifier(b"digest", None, None) + assert hash(aki1) == hash(aki2) + assert hash(aki1) != hash(aki3) + class TestBasicConstraints(object): def test_ca_not_boolean(self): |