Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
DEMO
Loading...
Searching...
No Matches
signet::forge::crypto::KyberKem Class Reference

Kyber-768 Key Encapsulation Mechanism (NIST FIPS 203 / ML-KEM-768). More...

#include <post_quantum.hpp>

Classes

struct  EncapsulationResult
 Result of Kyber-768 encapsulation: ciphertext to send + shared secret to keep. More...
 
struct  KeyPair
 Kyber-768 keypair: public key for encapsulation, secret key for decapsulation. More...
 

Static Public Member Functions

static expected< KeyPairgenerate_keypair ()
 Generate a Kyber-768 keypair.
 
static expected< EncapsulationResultencapsulate (const uint8_t *public_key, size_t pk_size)
 Generate a shared secret from a recipient's public key (encapsulation).
 
static expected< std::vector< uint8_t > > decapsulate (const uint8_t *ciphertext, size_t ct_size, const uint8_t *secret_key, size_t sk_size)
 Recover the shared secret from ciphertext + secret key (decapsulation).
 

Static Public Attributes

static constexpr size_t PUBLIC_KEY_SIZE = 1184
 Kyber-768 public key size (stub default).
 
static constexpr size_t SECRET_KEY_SIZE = 2400
 Kyber-768 secret key size (stub default).
 
static constexpr size_t CIPHERTEXT_SIZE = 1088
 Kyber-768 ciphertext size (stub default).
 
static constexpr size_t SHARED_SECRET_SIZE = 32
 Shared secret size (256 bits, for AES-256).
 

Detailed Description

Kyber-768 Key Encapsulation Mechanism (NIST FIPS 203 / ML-KEM-768).

Used to establish shared AES-256 keys between Parquet writer and reader. Provides approximately 192-bit post-quantum security.

Two modes of operation:

  • Bundled mode (default): SHA-256-based stubs for API testing. NOT cryptographically secure.
  • liboqs mode (SIGNET_HAS_LIBOQS): Real NIST-standardized Kyber-768.
See also
HybridKem for combined Kyber-768 + X25519 key exchange
DilithiumSign for post-quantum digital signatures

Definition at line 663 of file post_quantum.hpp.

Member Function Documentation

◆ decapsulate()

static expected< std::vector< uint8_t > > signet::forge::crypto::KyberKem::decapsulate ( const uint8_t *  ciphertext,
size_t  ct_size,
const uint8_t *  secret_key,
size_t  sk_size 
)
inlinestatic

Recover the shared secret from ciphertext + secret key (decapsulation).

The recipient calls this with the received ciphertext and their secret key.

Parameters
ciphertextPointer to the ciphertext from encapsulate().
ct_sizeMust equal CIPHERTEXT_SIZE (1088 bytes).
secret_keyPointer to the recipient's Kyber-768 secret key.
sk_sizeMust equal SECRET_KEY_SIZE (2400 bytes).
Returns
32-byte shared secret (identical to the sender's).

Definition at line 898 of file post_quantum.hpp.

◆ encapsulate()

static expected< EncapsulationResult > signet::forge::crypto::KyberKem::encapsulate ( const uint8_t *  public_key,
size_t  pk_size 
)
inlinestatic

Generate a shared secret from a recipient's public key (encapsulation).

The sender calls this with the recipient's public key.

Parameters
public_keyPointer to the recipient's Kyber-768 public key.
pk_sizeMust equal PUBLIC_KEY_SIZE (1184 bytes).
Returns
Ciphertext (to send) + shared secret (to use as AES-256 key).

Definition at line 785 of file post_quantum.hpp.

◆ generate_keypair()

static expected< KeyPair > signet::forge::crypto::KyberKem::generate_keypair ( )
inlinestatic

Generate a Kyber-768 keypair.

Returns
KeyPair with public_key (1184 bytes) and secret_key (2400 bytes), or an error on failure.

Definition at line 715 of file post_quantum.hpp.

Member Data Documentation

◆ CIPHERTEXT_SIZE

constexpr size_t signet::forge::crypto::KyberKem::CIPHERTEXT_SIZE = 1088
staticconstexpr

Kyber-768 ciphertext size (stub default).

Definition at line 678 of file post_quantum.hpp.

◆ PUBLIC_KEY_SIZE

constexpr size_t signet::forge::crypto::KyberKem::PUBLIC_KEY_SIZE = 1184
staticconstexpr

Kyber-768 public key size (stub default).

Definition at line 676 of file post_quantum.hpp.

◆ SECRET_KEY_SIZE

constexpr size_t signet::forge::crypto::KyberKem::SECRET_KEY_SIZE = 2400
staticconstexpr

Kyber-768 secret key size (stub default).

Definition at line 677 of file post_quantum.hpp.

◆ SHARED_SECRET_SIZE

constexpr size_t signet::forge::crypto::KyberKem::SHARED_SECRET_SIZE = 32
staticconstexpr

Shared secret size (256 bits, for AES-256).

Definition at line 679 of file post_quantum.hpp.


The documentation for this class was generated from the following file: