Source code for pcapkit.const.pcapng.tls_key_label

# -*- coding: utf-8 -*-
# pylint: disable=line-too-long,consider-using-f-string
"""TLS Key Log Labels
========================

.. module:: pcapkit.const.pcapng.tls_key_label

This module contains the constant enumeration for **TLS Key Log Labels**,
which is automatically generated from :class:`pcapkit.vendor.pcapng.tls_key_label.TLSKeyLabel`.

"""

from typing import TYPE_CHECKING

from aenum import StrEnum

from pcapkit.corekit.enum import EnumRegistry
from pcapkit.utilities.exceptions import EnumValueError

if TYPE_CHECKING:
    from typing import Any

__all__ = ['TLSKeyLabel']


[docs] class TLSKeyLabel(EnumRegistry, StrEnum): """[TLSKeyLabel] TLS Key Log Labels .. versionadded:: 1.5.0 Moved here from ``pcapkit.protocols.misc.pcapng`` (:issue:`886`). """ #: NSS-historical: not a registered label of :rfc:`9850#section-4.2`'s "TLS #: SSLKEYLOGFILE Labels" registry. Defined by the Mozilla NSS #: ``SSLKEYLOGFILE`` convention and removed in NSS 3.34; kept here only so #: that key logs predating :rfc:`9850` still read. RSA = 'RSA' #: Master secret in TLS 1.2 and earlier, c.f., :rfc:`9850#section-4.2`. CLIENT_RANDOM = 'CLIENT_RANDOM' #: Secret for client early data records, c.f., :rfc:`9850#section-4.2`. CLIENT_EARLY_TRAFFIC_SECRET = 'CLIENT_EARLY_TRAFFIC_SECRET' # nosec B105 #: Early exporter secret, c.f., :rfc:`9850#section-4.2`. EARLY_EXPORTER_SECRET = 'EARLY_EXPORTER_SECRET' # nosec B105 #: Secret protecting client handshake, c.f., :rfc:`9850#section-4.2`. CLIENT_HANDSHAKE_TRAFFIC_SECRET = 'CLIENT_HANDSHAKE_TRAFFIC_SECRET' # nosec B105 #: Secret protecting server handshake, c.f., :rfc:`9850#section-4.2`. SERVER_HANDSHAKE_TRAFFIC_SECRET = 'SERVER_HANDSHAKE_TRAFFIC_SECRET' # nosec B105 #: Secret protecting client records post handshake, c.f., #: :rfc:`9850#section-4.2`. CLIENT_TRAFFIC_SECRET_0 = 'CLIENT_TRAFFIC_SECRET_0' # nosec B105 #: Secret protecting server records post handshake, c.f., #: :rfc:`9850#section-4.2`. SERVER_TRAFFIC_SECRET_0 = 'SERVER_TRAFFIC_SECRET_0' # nosec B105 #: Exporter secret after handshake, c.f., :rfc:`9850#section-4.2`. EXPORTER_SECRET = 'EXPORTER_SECRET' # nosec B105 #: HPKE KEM shared secret used in the ECH, c.f., :rfc:`9850#section-4.2`. ECH_SECRET = 'ECH_SECRET' # nosec B105 #: ECHConfig used for construction of the ECH, c.f., :rfc:`9850#section-4.2`. ECH_CONFIG = 'ECH_CONFIG'
[docs] @classmethod def _validate_value(cls, value: 'Any') -> 'None': """Reject ``value`` unless it is a :class:`str`, this registry's member type. Overrides :meth:`~pcapkit.corekit.enum.EnumLookup._validate_value` so that :meth:`~pcapkit.corekit.enum.EnumRegistry.register` refuses a value :meth:`~pcapkit.corekit.enum.EnumLookup.get` refuses, in the same words (:issue:`1816`). There is no ``_missing_`` here to take a range from -- the constructor refuses every value no member carries -- so the member type is the whole check, and any :class:`str` label may still be minted. Args: value: Value about to be looked up or minted. Raises: EnumValueError: If ``value`` is not a :class:`str`. A :exc:`ValueError`, so an ``except ValueError`` caller is unaffected. """ if not isinstance(value, str): raise EnumValueError('%r is not a valid %s' % (value, cls.__name__))