Constants

Algorithm identifiers and HPKE modes (RFC 9180 §5, §7).

class rfc9180.constants.HPKEMode(*values)[source]

Bases: IntEnum

HPKE mode identifiers as defined in RFC 9180 §5, Table 1.

MODE_BASE

Base mode (0x00).

Type:

int

MODE_PSK

Pre-shared key mode (0x01).

Type:

int

MODE_AUTH

Authenticated mode (0x02).

Type:

int

MODE_AUTH_PSK

Authenticated pre-shared key mode (0x03).

Type:

int

MODE_BASE = 0
MODE_PSK = 1
MODE_AUTH = 2
MODE_AUTH_PSK = 3
class rfc9180.constants.KEMID(*values)[source]

Bases: IntEnum

Key Encapsulation Mechanism algorithm identifiers (RFC 9180 §7.1, Table 2).

DHKEM_P256_HKDF_SHA256

P-256 curve with HKDF-SHA256 (0x0010).

Type:

int

DHKEM_P384_HKDF_SHA384

P-384 curve with HKDF-SHA384 (0x0011).

Type:

int

DHKEM_P521_HKDF_SHA512

P-521 curve with HKDF-SHA512 (0x0012).

Type:

int

DHKEM_X25519_HKDF_SHA256

X25519 with HKDF-SHA256 (0x0020).

Type:

int

DHKEM_X448_HKDF_SHA512

X448 with HKDF-SHA512 (0x0021).

Type:

int

DHKEM_P256_HKDF_SHA256 = 16
DHKEM_P384_HKDF_SHA384 = 17
DHKEM_P521_HKDF_SHA512 = 18
DHKEM_X25519_HKDF_SHA256 = 32
DHKEM_X448_HKDF_SHA512 = 33
class rfc9180.constants.KDFID(*values)[source]

Bases: IntEnum

Key Derivation Function algorithm identifiers (RFC 9180 §7.2, Table 3).

HKDF_SHA256

HKDF with SHA-256 (0x0001).

Type:

int

HKDF_SHA384

HKDF with SHA-384 (0x0002).

Type:

int

HKDF_SHA512

HKDF with SHA-512 (0x0003).

Type:

int

HKDF_SHA256 = 1
HKDF_SHA384 = 2
HKDF_SHA512 = 3
class rfc9180.constants.AEADID(*values)[source]

Bases: IntEnum

Authenticated Encryption with Associated Data algorithm identifiers (RFC 9180 §7.3, Table 5).

AES_128_GCM

AES-128 in GCM mode (0x0001).

Type:

int

AES_256_GCM

AES-256 in GCM mode (0x0002).

Type:

int

CHACHA20_POLY1305

ChaCha20-Poly1305 (0x0003).

Type:

int

EXPORT_ONLY

Export-only mode, no encryption (0xFFFF).

Type:

int

AES_128_GCM = 1
AES_256_GCM = 2
CHACHA20_POLY1305 = 3
EXPORT_ONLY = 65535

Parameter Dictionaries

The module also defines parameter dictionaries for algorithm sizes:

  • KEM_PARAMS: Per-KEM sizes (Nsecret, Nenc, Npk, Nsk, Ndh)

  • KDF_PARAMS: Per-KDF sizes (Nh)

  • AEAD_PARAMS: Per-AEAD sizes (Nk, Nn, Nt)

These are used internally and can be useful when implementing custom wire formats (e.g. Nenc for parse_header).