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

Hybrid Key Encapsulation combining Kyber-768 (post-quantum) and X25519 (classical). More...

#include <post_quantum.hpp>

Classes

struct  HybridEncapsResult
 Result of hybrid encapsulation. More...
 
struct  HybridKeyPair
 Hybrid keypair: Kyber-768 + X25519 components. More...
 

Static Public Member Functions

static expected< HybridKeyPairgenerate_keypair ()
 Generate a hybrid Kyber-768 + X25519 (RFC 7748) keypair.
 
static expected< HybridEncapsResultencapsulate (const HybridKeyPair &recipient_pk)
 Hybrid encapsulation: Kyber-768 + X25519 DH key agreement.
 
static expected< std::vector< uint8_t > > decapsulate (const HybridEncapsResult &encaps, const HybridKeyPair &recipient_sk)
 Hybrid decapsulation: recovers the same shared secret as encapsulate().
 

Static Public Attributes

static constexpr size_t X25519_PUBLIC_KEY_SIZE = 32
 X25519 public key size in bytes.
 
static constexpr size_t X25519_SECRET_KEY_SIZE = 32
 X25519 secret key size in bytes.
 
static constexpr size_t HYBRID_SHARED_SECRET_SIZE = 32
 Combined shared secret size (SHA-256 output).
 

Detailed Description

Hybrid Key Encapsulation combining Kyber-768 (post-quantum) and X25519 (classical).

The shared secret is derived as SHA-256(kyber_ss || x25519_ss), providing defense-in-depth: even if one algorithm is broken, the other still provides security. Follows the NIST/IETF Composite KEM approach.

X25519 uses the real constant-time Montgomery ladder in detail::x25519 (RFC 7748) in both bundled and liboqs modes.

See also
KyberKem for standalone Kyber-768
DilithiumSign for post-quantum signatures

Definition at line 1339 of file post_quantum.hpp.

Member Function Documentation

◆ decapsulate()

static expected< std::vector< uint8_t > > signet::forge::crypto::HybridKem::decapsulate ( const HybridEncapsResult encaps,
const HybridKeyPair recipient_sk 
)
inlinestatic

Hybrid decapsulation: recovers the same shared secret as encapsulate().

X25519 DH is commutative: X25519(eph_sk, recip_pk) == X25519(recip_sk, eph_pk).

Parameters
encapsEncapsulation result (ciphertext + ephemeral pk).
recipient_skRecipient's full hybrid keypair (secret keys used).
Returns
32-byte combined shared secret, identical to encapsulate()'s output.

Definition at line 1483 of file post_quantum.hpp.

◆ encapsulate()

static expected< HybridEncapsResult > signet::forge::crypto::HybridKem::encapsulate ( const HybridKeyPair recipient_pk)
inlinestatic

Hybrid encapsulation: Kyber-768 + X25519 DH key agreement.

Parameters
recipient_pkRecipient's hybrid keypair (only public keys used).
Returns
Kyber ciphertext + ephemeral X25519 pk + combined shared secret.

Definition at line 1418 of file post_quantum.hpp.

◆ generate_keypair()

static expected< HybridKeyPair > signet::forge::crypto::HybridKem::generate_keypair ( )
inlinestatic

Generate a hybrid Kyber-768 + X25519 (RFC 7748) keypair.

Returns
HybridKeyPair with all four key components, or an error on failure.

Definition at line 1378 of file post_quantum.hpp.

Member Data Documentation

◆ HYBRID_SHARED_SECRET_SIZE

constexpr size_t signet::forge::crypto::HybridKem::HYBRID_SHARED_SECRET_SIZE = 32
staticconstexpr

Combined shared secret size (SHA-256 output).

Definition at line 1343 of file post_quantum.hpp.

◆ X25519_PUBLIC_KEY_SIZE

constexpr size_t signet::forge::crypto::HybridKem::X25519_PUBLIC_KEY_SIZE = 32
staticconstexpr

X25519 public key size in bytes.

Definition at line 1341 of file post_quantum.hpp.

◆ X25519_SECRET_KEY_SIZE

constexpr size_t signet::forge::crypto::HybridKem::X25519_SECRET_KEY_SIZE = 32
staticconstexpr

X25519 secret key size in bytes.

Definition at line 1342 of file post_quantum.hpp.


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