# Path: scapy/config.py
# class ConfClass(object):
# class Interceptor(object):
# class ProgPath(ConfClass):
# class ConfigFieldList:
# class Emphasize(ConfigFieldList):
# class Resolve(ConfigFieldList):
# class Num2Layer:
# class LayersList(List[Type['scapy.packet.Packet']]):
# class CommandsList(List[Callable[..., Any]]):
# class CacheInstance(Dict[str, Any], object):
# class NetCache:
# class Conf(ConfClass):
#     def configure(self, cnf):
#     def __repr__(self):
#     def __str__(self):
#     def __init__(self,
#                  name,  # type: str
#                  default,  # type: Any
#                  hook,  # type: Callable[..., Any]
#                  args=None,  # type: Optional[List[Any]]
#                  kargs=None  # type: Optional[Dict[str, Any]]
#                  ):
#     def __get__(self, obj, typ=None):
#     def set_from_hook(obj, name, val):
#     def __set__(self, obj, val):
# def _readonly(name):
#     def __init__(self):
#     def _is_field(f):
#     def _recalc_layer_list(self):
#     def add(self, *flds):
#     def remove(self, *flds):
#     def __contains__(self, elt):
#     def __repr__(self):
#     def __init__(self):
#     def register(self, num, layer):
#     def register_num2layer(self, num, layer):
#     def register_layer2num(self, num, layer):
#     def __getitem__(self, item):
#     def __contains__(self, item):
#     def get(self,
#             item,  # type: Union[int, Type[Packet]]
#             default=None,  # type: Optional[Type[Packet]]
#             ):
#     def __repr__(self):
#     def __init__(self):
#     def __repr__(self):
#     def register(self, layer):
#     def layers(self):
#     def filter(self, items):
#     def unfilter(self):
#     def __repr__(self):
#     def register(self, cmd):
# def lsc():
#     def __init__(self, name="noname", timeout=None):
#     def flush(self):
#     def __getitem__(self, item):
#     def get(self, item, default=None):
#     def __setitem__(self, item, v):
#     def update(self,  # type: ignore
#                other,  # type: Any
#                **kwargs  # type: Any
#                ):
#     def iteritems(self):
#     def iterkeys(self):
#     def __iter__(self):
#     def itervalues(self):
#     def items(self):
#     def keys(self):
#     def values(self):
#     def __len__(self):
#     def summary(self):
#     def __repr__(self):
#     def copy(self):
#     def __init__(self):
#     def add_cache(self, cache):
#     def new_cache(self, name, timeout=None):
#     def __delattr__(self, attr):
#     def update(self, other):
#     def flush(self):
#     def __repr__(self):
# def _version_checker(module, minver):
# def isCryptographyValid():
# def isCryptographyAdvanced():
# def isPyPy():
# def _prompt_changer(attr, val, old):
# def _set_conf_sockets():
# def _socket_changer(attr, val, old):
# def _loglevel_changer(attr, val, old):
# def _iface_changer(attr, val, old):
#     def __getattribute__(self, attr):
# def crypto_validator(func):
#     def func_in(*args, **kwargs):
# def scapy_delete_temp_files():
# 
# Path: scapy/compat.py
# def bytes_int(x):
#     # type: (bytes) -> int
#     """Convert an arbitrary sized bytes string to an int"""
#     return int(x.encode('hex'), 16)
# 
# def int_bytes(x, size):
#     # type: (int, int) -> bytes
#     """Convert an int to an arbitrary sized bytes string"""
#     _hx = hex(x)[2:].strip("L")
#     return binascii.unhexlify("0" * (size * 2 - len(_hx)) + _hx)
# 
# Path: scapy/utils.py
# def long_converter(s):
#     # type: (str) -> int
#     return int(s.replace('\n', '').replace(' ', ''), 16)


from scapy.config import conf
from scapy.compat import bytes_int, int_bytes
from scapy.error import warning
from scapy.utils import long_converter
    from cryptography.hazmat.backends import default_backend
    from cryptography.hazmat.primitives.asymmetric import dh, ec
    from cryptography.hazmat.primitives import serialization
    from cryptography.hazmat.primitives.asymmetric import x25519
    from cryptography.hazmat.primitives.asymmetric import x448
    from cryptography.hazmat.primitives.asymmetric.dh import DHParameterNumbers
import scapy.modules.six as six
# This file is part of Scapy
# Copyright (C) 2007, 2008, 2009 Arnaud Ebalard
#               2015, 2016, 2017 Maxence Tury
# This program is published under a GPLv2 license

"""
This is a register for DH groups from RFC 3526 and RFC 4306.
At this time the groups from RFC 7919 have not been registered by openssl,
thus they cannot be imported from the cryptography library.

We also provide TLS identifiers for these DH groups and also the ECDH groups.
(Note that the equivalent of _ffdh_groups for ECDH is ec._CURVE_TYPES.)
"""

from __future__ import absolute_import

if conf.crypto_valid:
if conf.crypto_valid_advanced:

# We have to start by a dirty hack in order to allow long generators,
# which some versions of openssl love to use...


# Path: scapy/config.py
# class ConfClass(object):
# class Interceptor(object):
# class ProgPath(ConfClass):
# class ConfigFieldList:
# class Emphasize(ConfigFieldList):
# class Resolve(ConfigFieldList):
# class Num2Layer:
# class LayersList(List[Type['scapy.packet.Packet']]):
# class CommandsList(List[Callable[..., Any]]):
# class CacheInstance(Dict[str, Any], object):
# class NetCache:
# class Conf(ConfClass):
#     def configure(self, cnf):
#     def __repr__(self):
#     def __str__(self):
#     def __init__(self,
#                  name,  # type: str
#                  default,  # type: Any
#                  hook,  # type: Callable[..., Any]
#                  args=None,  # type: Optional[List[Any]]
#                  kargs=None  # type: Optional[Dict[str, Any]]
#                  ):
#     def __get__(self, obj, typ=None):
#     def set_from_hook(obj, name, val):
#     def __set__(self, obj, val):
# def _readonly(name):
#     def __init__(self):
#     def _is_field(f):
#     def _recalc_layer_list(self):
#     def add(self, *flds):
#     def remove(self, *flds):
#     def __contains__(self, elt):
#     def __repr__(self):
#     def __init__(self):
#     def register(self, num, layer):
#     def register_num2layer(self, num, layer):
#     def register_layer2num(self, num, layer):
#     def __getitem__(self, item):
#     def __contains__(self, item):
#     def get(self,
#             item,  # type: Union[int, Type[Packet]]
#             default=None,  # type: Optional[Type[Packet]]
#             ):
#     def __repr__(self):
#     def __init__(self):
#     def __repr__(self):
#     def register(self, layer):
#     def layers(self):
#     def filter(self, items):
#     def unfilter(self):
#     def __repr__(self):
#     def register(self, cmd):
# def lsc():
#     def __init__(self, name="noname", timeout=None):
#     def flush(self):
#     def __getitem__(self, item):
#     def get(self, item, default=None):
#     def __setitem__(self, item, v):
#     def update(self,  # type: ignore
#                other,  # type: Any
#                **kwargs  # type: Any
#                ):
#     def iteritems(self):
#     def iterkeys(self):
#     def __iter__(self):
#     def itervalues(self):
#     def items(self):
#     def keys(self):
#     def values(self):
#     def __len__(self):
#     def summary(self):
#     def __repr__(self):
#     def copy(self):
#     def __init__(self):
#     def add_cache(self, cache):
#     def new_cache(self, name, timeout=None):
#     def __delattr__(self, attr):
#     def update(self, other):
#     def flush(self):
#     def __repr__(self):
# def _version_checker(module, minver):
# def isCryptographyValid():
# def isCryptographyAdvanced():
# def isPyPy():
# def _prompt_changer(attr, val, old):
# def _set_conf_sockets():
# def _socket_changer(attr, val, old):
# def _loglevel_changer(attr, val, old):
# def _iface_changer(attr, val, old):
#     def __getattribute__(self, attr):
# def crypto_validator(func):
#     def func_in(*args, **kwargs):
# def scapy_delete_temp_files():
# 
# Path: scapy/compat.py
# def bytes_int(x):
#     # type: (bytes) -> int
#     """Convert an arbitrary sized bytes string to an int"""
#     return int(x.encode('hex'), 16)
# 
# def int_bytes(x, size):
#     # type: (int, int) -> bytes
#     """Convert an int to an arbitrary sized bytes string"""
#     _hx = hex(x)[2:].strip("L")
#     return binascii.unhexlify("0" * (size * 2 - len(_hx)) + _hx)
# 
# Path: scapy/utils.py
# def long_converter(s):
#     # type: (str) -> int
#     return int(s.replace('\n', '').replace(' ', ''), 16)


# Path: scapy/layers/tls/crypto/groups.py
from scapy.config import conf
from scapy.compat import bytes_int, int_bytes
from scapy.error import warning
from scapy.utils import long_converter
    from cryptography.hazmat.backends import default_backend
    from cryptography.hazmat.primitives.asymmetric import dh, ec
    from cryptography.hazmat.primitives import serialization
    from cryptography.hazmat.primitives.asymmetric import x25519
    from cryptography.hazmat.primitives.asymmetric import x448
    from cryptography.hazmat.primitives.asymmetric.dh import DHParameterNumbers
import scapy.modules.six as six

# This file is part of Scapy
# Copyright (C) 2007, 2008, 2009 Arnaud Ebalard
#               2015, 2016, 2017 Maxence Tury
# This program is published under a GPLv2 license

"""
This is a register for DH groups from RFC 3526 and RFC 4306.
At this time the groups from RFC 7919 have not been registered by openssl,
thus they cannot be imported from the cryptography library.

We also provide TLS identifiers for these DH groups and also the ECDH groups.
(Note that the equivalent of _ffdh_groups for ECDH is ec._CURVE_TYPES.)
"""

from __future__ import absolute_import

if conf.crypto_valid:
if conf.crypto_valid_advanced:

# We have to start by a dirty hack in order to allow long generators,
# which some versions of openssl love to use...


if conf.crypto_valid: