diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2017-07-09 07:34:58 -0500 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2017-07-09 08:34:58 -0400 |
commit | 9d5fc3e5dbe581e1fea9303e684ec9248936df55 (patch) | |
tree | 6a769a585ba9c2c5e121bb55c169dba17a814c77 /src/cryptography/hazmat/primitives/ciphers | |
parent | 0c9aed91697c5bc1eb16c2254406149e2395fdae (diff) | |
download | cryptography-9d5fc3e5dbe581e1fea9303e684ec9248936df55.tar.gz cryptography-9d5fc3e5dbe581e1fea9303e684ec9248936df55.tar.bz2 cryptography-9d5fc3e5dbe581e1fea9303e684ec9248936df55.zip |
use an instance in aead_cipher_supported (#3772)
* use an instance in aead_cipher_supported
* test for chacha20poly1305 compatibility via init exception
* pep8
Diffstat (limited to 'src/cryptography/hazmat/primitives/ciphers')
-rw-r--r-- | src/cryptography/hazmat/primitives/ciphers/aead.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cryptography/hazmat/primitives/ciphers/aead.py b/src/cryptography/hazmat/primitives/ciphers/aead.py index 7d2103d3..8df55fab 100644 --- a/src/cryptography/hazmat/primitives/ciphers/aead.py +++ b/src/cryptography/hazmat/primitives/ciphers/aead.py @@ -13,7 +13,7 @@ from cryptography.hazmat.backends.openssl.backend import backend class ChaCha20Poly1305(object): def __init__(self, key): - if not backend.aead_cipher_supported(type(self)): + if not backend.aead_cipher_supported(self): raise exceptions.UnsupportedAlgorithm( "ChaCha20Poly1305 is not supported by this version of OpenSSL", exceptions._Reasons.UNSUPPORTED_CIPHER @@ -35,7 +35,7 @@ class ChaCha20Poly1305(object): self._check_params(nonce, data, associated_data) return aead._encrypt( - backend, type(self), self._key, nonce, data, associated_data, 16 + backend, self, nonce, data, associated_data, 16 ) def decrypt(self, nonce, data, associated_data): @@ -44,7 +44,7 @@ class ChaCha20Poly1305(object): self._check_params(nonce, data, associated_data) return aead._decrypt( - backend, type(self), self._key, nonce, data, associated_data, 16 + backend, self, nonce, data, associated_data, 16 ) def _check_params(self, nonce, data, associated_data): |