diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2013-11-06 16:00:08 +0800 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2013-11-06 16:00:08 +0800 |
commit | dd0b51b92d9bafe6aaacc2565ace0c591a493965 (patch) | |
tree | b9990c3b9fd6113d4e189eaedcc77aef680e5ff2 /cryptography/hazmat/primitives/ciphers/algorithms.py | |
parent | 051099ee7ea64b902fc9821f139d0a955bfe8bc4 (diff) | |
download | cryptography-dd0b51b92d9bafe6aaacc2565ace0c591a493965.tar.gz cryptography-dd0b51b92d9bafe6aaacc2565ace0c591a493965.tar.bz2 cryptography-dd0b51b92d9bafe6aaacc2565ace0c591a493965.zip |
re-add base.py
Diffstat (limited to 'cryptography/hazmat/primitives/ciphers/algorithms.py')
-rw-r--r-- | cryptography/hazmat/primitives/ciphers/algorithms.py | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/cryptography/hazmat/primitives/ciphers/algorithms.py b/cryptography/hazmat/primitives/ciphers/algorithms.py index 56dca216..8046bd26 100644 --- a/cryptography/hazmat/primitives/ciphers/algorithms.py +++ b/cryptography/hazmat/primitives/ciphers/algorithms.py @@ -13,50 +13,6 @@ from __future__ import absolute_import, division, print_function -from cryptography.hazmat.primitives import interfaces - - -class Cipher(object): - def __init__(self, algorithm, mode, backend=None): - super(Cipher, self).__init__() - - if backend is None: - from cryptography.hazmat.bindings import ( - _default_backend as backend, - ) - - self.algorithm = algorithm - self.mode = mode - self._backend = backend - - def encryptor(self): - return _CipherContext( - self._backend.ciphers.create_encrypt_ctx(self.algorithm, - self.mode)) - - def decryptor(self): - return _CipherContext( - self._backend.ciphers.create_decrypt_ctx(self.algorithm, - self.mode)) - - -@interfaces.register(interfaces.CipherContext) -class _CipherContext(object): - def __init__(self, ctx): - self._ctx = ctx - - def update(self, data): - if self._ctx is None: - raise ValueError("Context was already finalized") - return self._ctx.update(data) - - def finalize(self): - if self._ctx is None: - raise ValueError("Context was already finalized") - data = self._ctx.finalize() - self._ctx = None - return data - class AES(object): name = "AES" |