blob: c8e0af0f25275ed0c7f51cbc411311b79d2faf52 [file] [log] [blame]
Paul Kehrerdff22d42013-09-27 13:43:06 -05001# Licensed under the Apache License, Version 2.0 (the "License");
2# you may not use this file except in compliance with the License.
3# You may obtain a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS,
9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10# implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14"""
Alex Gaynor1fe70b12013-10-16 11:59:17 -070015Tests using the CRYPTREC (Camellia) Test Vectors
Paul Kehrerdff22d42013-09-27 13:43:06 -050016"""
17
18from __future__ import absolute_import, division, print_function
19
20import binascii
Paul Kehrerdff22d42013-09-27 13:43:06 -050021
Alex Gaynor1fe70b12013-10-16 11:59:17 -070022from cryptography.primitives.block import ciphers, modes
Paul Kehrerdff22d42013-09-27 13:43:06 -050023
Alex Gaynor1fe70b12013-10-16 11:59:17 -070024from .utils import generate_encrypt_test
Paul Kehrerdff22d42013-09-27 13:43:06 -050025from ..utils import load_cryptrec_vectors_from_file
26
Paul Kehrerdff22d42013-09-27 13:43:06 -050027
Paul Kehrerdff22d42013-09-27 13:43:06 -050028class TestCamelliaECB(object):
Alex Gaynor1fe70b12013-10-16 11:59:17 -070029 test_NTT = generate_encrypt_test(
30 load_cryptrec_vectors_from_file,
31 "Camellia",
32 "NTT",
33 ["camellia-128-ecb", "camellia-192-ecb", "camellia-256"],
34 lambda key: ciphers.Camellia(binascii.unhexlify((key))),
35 lambda key: modes.EBC(),
36 only_if=lambda api: api.supports_cipher("camellia-128-ecb")
Paul Kehrerdff22d42013-09-27 13:43:06 -050037 )