diff options
author | Hynek Schlawack <hs@ox.cx> | 2013-09-07 12:14:31 -0700 |
---|---|---|
committer | Hynek Schlawack <hs@ox.cx> | 2013-09-07 12:14:31 -0700 |
commit | 5e00e96f20f8c70614b463015e64a277a4348576 (patch) | |
tree | 416db58071e8bc6ad51f613e7c01edb9cfb6ae64 /tests/primitives/test_ciphers.py | |
parent | a53f81dbb49a8504559e9d8ef7e2dd386c15ed41 (diff) | |
parent | aaa22171618e18888d0a0487d4564bcdae5c2015 (diff) | |
download | cryptography-5e00e96f20f8c70614b463015e64a277a4348576.tar.gz cryptography-5e00e96f20f8c70614b463015e64a277a4348576.tar.bz2 cryptography-5e00e96f20f8c70614b463015e64a277a4348576.zip |
Merge pull request #28 from alex/simple-symmetric-encryption
[WIP] initial implementation of symmetric encryption
Diffstat (limited to 'tests/primitives/test_ciphers.py')
-rw-r--r-- | tests/primitives/test_ciphers.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/primitives/test_ciphers.py b/tests/primitives/test_ciphers.py new file mode 100644 index 00000000..5ee9f223 --- /dev/null +++ b/tests/primitives/test_ciphers.py @@ -0,0 +1,35 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import, division, print_function + +import binascii + +import pytest + +from cryptography.primitives.block.ciphers import AES + + +class TestAES(object): + @pytest.mark.parametrize(("key", "keysize"), [ + (b"0" * 32, 128), + (b"0" * 48, 192), + (b"0" * 64, 256), + ]) + def test_key_size(self, key, keysize): + cipher = AES(binascii.unhexlify(key)) + assert cipher.key_size == keysize + + def test_invalid_key_size(self): + with pytest.raises(ValueError): + AES(binascii.unhexlify(b"0" * 12)) |