Skip to content

Commit

Permalink
Remove usage of cryptography's register_interface
Browse files Browse the repository at this point in the history
  • Loading branch information
gpotter2 authored and p-l- committed Sep 10, 2022
1 parent 68f2b5d commit bb1ed01
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 1 addition & 4 deletions scapy/layers/tls/crypto/cipher_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

if conf.crypto_valid:
from cryptography.utils import (
register_interface,
CryptographyDeprecationWarning,
)
from cryptography.hazmat.primitives.ciphers import (Cipher, algorithms, modes, # noqa: E501
Expand Down Expand Up @@ -193,9 +192,7 @@ class Cipher_SEED_CBC(_BlockCipher):
# silently not declared, and the corresponding suites will have 'usable' False.

if conf.crypto_valid:
@register_interface(BlockCipherAlgorithm)
@register_interface(CipherAlgorithm)
class _ARC2(object):
class _ARC2(BlockCipherAlgorithm, CipherAlgorithm):
name = "RC2"
block_size = 64
key_sizes = frozenset([128])
Expand Down
4 changes: 1 addition & 3 deletions scapy/layers/tls/crypto/pkcs1.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from scapy.config import conf, crypto_validator
from scapy.error import warning
if conf.crypto_valid:
from cryptography import utils
from cryptography.exceptions import InvalidSignature, UnsupportedAlgorithm
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
Expand Down Expand Up @@ -96,8 +95,7 @@ def _legacy_pkcs1_v1_5_encode_md5_sha1(M, emLen):
if conf.crypto_valid:

# first, we add the "md5-sha1" hash from openssl to python-cryptography
@utils.register_interface(HashAlgorithm)
class MD5_SHA1(object):
class MD5_SHA1(HashAlgorithm):
name = "md5-sha1"
digest_size = 36
block_size = 64
Expand Down

0 comments on commit bb1ed01

Please sign in to comment.