コード例 #1
0
 def test_register_duplicate_cipher_adapter(self):
     with pytest.raises(ValueError):
         backend.register_cipher_adapter(AES, CBC, None)
コード例 #2
0
ファイル: cipher_block.py プロジェクト: william-stearns/scapy
        def __init__(self, key):
            self.key = algorithms._verify_key_size(self, key)

        @property
        def key_size(self):
            return len(self.key) * 8

    _gcbn_format = "{cipher.name}-{mode.name}"
    if GetCipherByName(_gcbn_format)(backend, _ARC2, modes.CBC) != \
            backend._ffi.NULL:

        class Cipher_RC2_CBC(_BlockCipher):
            pc_cls = _ARC2
            pc_cls_mode = modes.CBC
            block_size = 8
            key_len = 16

        class Cipher_RC2_CBC_40(Cipher_RC2_CBC):
            expanded_key_len = 16
            key_len = 5

        backend.register_cipher_adapter(Cipher_RC2_CBC.pc_cls,
                                        Cipher_RC2_CBC.pc_cls_mode,
                                        GetCipherByName(_gcbn_format))

        _sslv2_block_cipher_algs["RC2_128_CBC"] = Cipher_RC2_CBC


_tls_block_cipher_algs.update(_sslv2_block_cipher_algs)
コード例 #3
0
ファイル: test_openssl.py プロジェクト: Ayrx/cryptography
 def test_register_duplicate_cipher_adapter(self):
     with pytest.raises(ValueError):
         backend.register_cipher_adapter(AES, CBC, None)
コード例 #4
0
ファイル: cipher_block.py プロジェクト: 6WIND/scapy
            self.key = algorithms._verify_key_size(self, key)

        @property
        def key_size(self):
            return len(self.key) * 8


    _gcbn_format = "{cipher.name}-{mode.name}"
    if GetCipherByName(_gcbn_format)(backend, _ARC2, modes.CBC) != \
            backend._ffi.NULL:

        class Cipher_RC2_CBC(_BlockCipher):
            pc_cls = _ARC2
            pc_cls_mode = modes.CBC
            block_size = 8
            key_len = 16

        class Cipher_RC2_CBC_40(Cipher_RC2_CBC):
            expanded_key_len = 16
            key_len = 5

        backend.register_cipher_adapter(Cipher_RC2_CBC.pc_cls,
                                        Cipher_RC2_CBC.pc_cls_mode,
                                        GetCipherByName(_gcbn_format))

        _sslv2_block_cipher_algs["RC2_128_CBC"] = Cipher_RC2_CBC


_tls_block_cipher_algs.update(_sslv2_block_cipher_algs)