aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/x509
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2017-09-14 04:24:30 +0800
committerAlex Gaynor <alex.gaynor@gmail.com>2017-09-13 16:24:30 -0400
commit979c26303fbd6a2f4044855d989f4a74a4d51ac5 (patch)
tree1aae87422896b36a11a34f1f4ffe08e583e62edc /src/cryptography/x509
parentbdad051b9987951b4838e5c3458f6ba38b4e2ccf (diff)
downloadcryptography-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 'src/cryptography/x509')
-rw-r--r--src/cryptography/x509/extensions.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py
index 01378b38..8880f744 100644
--- a/src/cryptography/x509/extensions.py
+++ b/src/cryptography/x509/extensions.py
@@ -213,6 +213,15 @@ class AuthorityKeyIdentifier(object):
def __ne__(self, other):
return not self == other
+ def __hash__(self):
+ if self.authority_cert_issuer is None:
+ aci = None
+ else:
+ aci = tuple(self.authority_cert_issuer)
+ return hash((
+ self.key_identifier, aci, self.authority_cert_serial_number
+ ))
+
key_identifier = utils.read_only_property("_key_identifier")
authority_cert_issuer = utils.read_only_property("_authority_cert_issuer")
authority_cert_serial_number = utils.read_only_property(