aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorDonald Stufft <donald@stufft.io>2013-08-10 15:13:22 -0400
committerDonald Stufft <donald@stufft.io>2013-08-10 15:13:22 -0400
commitadacdb85a6e102a0b9ee188ccfce93c22bde182e (patch)
treeaf2ec4e72ca88f1faf62a9760797d5c4078e2ade /cryptography
parent93e768b52c03fb33ff46124c17d4e1b2a13693fe (diff)
downloadcryptography-adacdb85a6e102a0b9ee188ccfce93c22bde182e.tar.gz
cryptography-adacdb85a6e102a0b9ee188ccfce93c22bde182e.tar.bz2
cryptography-adacdb85a6e102a0b9ee188ccfce93c22bde182e.zip
BlockCiphers should know their own name
We normalize on CIPHER-KEYSIZE-MODE for the block cipher name.
Diffstat (limited to 'cryptography')
-rw-r--r--cryptography/primitives/block/base.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/cryptography/primitives/block/base.py b/cryptography/primitives/block/base.py
index 2a6a5c37..207c83d9 100644
--- a/cryptography/primitives/block/base.py
+++ b/cryptography/primitives/block/base.py
@@ -23,6 +23,12 @@ class BlockCipher(object):
self._ctx = api.create_block_cipher_context(cipher, mode)
self._operation = None
+ @property
+ def name(self):
+ return "{0}-{1}-{2}".format(
+ self.cipher.name, self.cipher.key_size, self.mode.name,
+ )
+
def encrypt(self, plaintext):
if self._ctx is None:
raise ValueError("BlockCipher was already finalized")