diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2013-10-16 16:55:40 -0700 | 
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@gmail.com> | 2013-10-16 16:55:40 -0700 | 
| commit | e761f8b33519104605b14cf8a24e9f68bd23b624 (patch) | |
| tree | 672968fa7c23790bc9f5c9cd3c779adce09fae8c /tests/primitives/test_cryptrec.py | |
| parent | 62ebc7e212a92a13c3836de5d129cb93f40a128d (diff) | |
| parent | 169dee88faa7c46b5551b89cf97a1b30c0a1c6ea (diff) | |
| download | cryptography-e761f8b33519104605b14cf8a24e9f68bd23b624.tar.gz cryptography-e761f8b33519104605b14cf8a24e9f68bd23b624.tar.bz2 cryptography-e761f8b33519104605b14cf8a24e9f68bd23b624.zip  | |
Merge branch 'master' into triple-des
Also moved most of the tests to the new format except for one which doesn't yet
have an obvious translation
Conflicts:
	cryptography/primitives/block/ciphers.py
	tests/primitives/test_nist.py
Diffstat (limited to 'tests/primitives/test_cryptrec.py')
| -rw-r--r-- | tests/primitives/test_cryptrec.py | 42 | 
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/primitives/test_cryptrec.py b/tests/primitives/test_cryptrec.py new file mode 100644 index 00000000..edf97652 --- /dev/null +++ b/tests/primitives/test_cryptrec.py @@ -0,0 +1,42 @@ +# 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. + +""" +Tests using the CRYPTREC (Camellia) Test Vectors +""" + +from __future__ import absolute_import, division, print_function + +import binascii +import os + +from cryptography.primitives.block import ciphers, modes + +from .utils import generate_encrypt_test +from ..utils import load_cryptrec_vectors_from_file + + +class TestCamelliaECB(object): +    test_NTT = generate_encrypt_test( +        load_cryptrec_vectors_from_file, +        os.path.join("Camellia", "NTT"), +        [ +            "camellia-128-ecb.txt", +            "camellia-192-ecb.txt", +            "camellia-256-ecb.txt" +        ], +        lambda key: ciphers.Camellia(binascii.unhexlify((key))), +        lambda key: modes.ECB(), +        only_if=lambda api: api.supports_cipher("camellia-128-ecb"), +        skip_message="Does not support Camellia ECB", +    )  | 
