diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2018-10-30 10:23:30 +0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2018-10-29 22:23:30 -0400 |
commit | 74ce48c5d00e4846740d248a65d35b874f15afe2 (patch) | |
tree | 6926bba7f30e2d435dea5a86ec102130be084dd5 /src/cryptography/x509 | |
parent | d91401d4d38d7f738392a69df43b4fd8b8e6c6e8 (diff) | |
download | cryptography-74ce48c5d00e4846740d248a65d35b874f15afe2.tar.gz cryptography-74ce48c5d00e4846740d248a65d35b874f15afe2.tar.bz2 cryptography-74ce48c5d00e4846740d248a65d35b874f15afe2.zip |
Add eq/ne/hash to PrecertificateSignedCertificateTimestamps (#4534)
* Add eq/ne/hash to PrecertificateSignedCertificateTimestamps
This requires adding it to SignedCertificateTimestamps as well
* slightly more consistent
* right, these need to be conditional
* compare by signature
* don't use private API
Diffstat (limited to 'src/cryptography/x509')
-rw-r--r-- | src/cryptography/x509/extensions.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py index b2d9908e..6301af5a 100644 --- a/src/cryptography/x509/extensions.py +++ b/src/cryptography/x509/extensions.py @@ -1402,6 +1402,21 @@ class PrecertificateSignedCertificateTimestamps(object): ) ) + def __hash__(self): + return hash(tuple(self._signed_certificate_timestamps)) + + def __eq__(self, other): + if not isinstance(other, PrecertificateSignedCertificateTimestamps): + return NotImplemented + + return ( + self._signed_certificate_timestamps == + other._signed_certificate_timestamps + ) + + def __ne__(self, other): + return not self == other + @utils.register_interface(ExtensionType) class OCSPNonce(object): |