Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
DEMO
Loading...
Searching...
No Matches
post_quantum.hpp File Reference

Post-quantum cryptography: Kyber-768 KEM, Dilithium-3 signatures, X25519 ECDH, and HybridKem (Kyber+X25519) for Parquet encryption. More...

#include "signet/error.hpp"
#include "signet/crypto/cipher_interface.hpp"
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <random>
#include <string>
#include <utility>
#include <vector>
#include "signet/crypto/sha256.hpp"

Go to the source code of this file.

Classes

class  signet::forge::crypto::KyberKem
 Kyber-768 Key Encapsulation Mechanism (NIST FIPS 203 / ML-KEM-768). More...
 
struct  signet::forge::crypto::KyberKem::KeyPair
 Kyber-768 keypair: public key for encapsulation, secret key for decapsulation. More...
 
struct  signet::forge::crypto::KyberKem::EncapsulationResult
 Result of Kyber-768 encapsulation: ciphertext to send + shared secret to keep. More...
 
class  signet::forge::crypto::DilithiumSign
 Dilithium-3 digital signature scheme (NIST FIPS 204 / ML-DSA-65). More...
 
struct  signet::forge::crypto::DilithiumSign::SignKeyPair
 Dilithium-3 signing keypair: public key for verification, secret key for signing. More...
 
class  signet::forge::crypto::HybridKem
 Hybrid Key Encapsulation combining Kyber-768 (post-quantum) and X25519 (classical). More...
 
struct  signet::forge::crypto::HybridKem::HybridKeyPair
 Hybrid keypair: Kyber-768 + X25519 components. More...
 
struct  signet::forge::crypto::HybridKem::HybridEncapsResult
 Result of hybrid encapsulation. More...
 
struct  signet::forge::crypto::PostQuantumConfig
 Configuration for post-quantum encryption in Parquet Modular Encryption. More...
 

Namespaces

namespace  signet
 
namespace  signet::forge
 
namespace  signet::forge::crypto
 
namespace  signet::forge::crypto::detail
 
namespace  signet::forge::crypto::detail::pq
 
namespace  signet::forge::crypto::detail::x25519
 

Typedefs

using signet::forge::crypto::detail::x25519::Fe = std::array< int32_t, 10 >
 GF(2^255-19) field element: 10 limbs, radix 2^25.5 (alternating 26 and 25 bits).
 

Functions

bool signet::forge::crypto::is_real_pq_crypto () noexcept
 Runtime query: returns true if post-quantum crypto is backed by real liboqs implementations (Kyber-768, Dilithium-3), false if using bundled stubs.
 
void signet::forge::crypto::detail::pq::random_bytes (uint8_t *buf, size_t size)
 Fill a buffer with cryptographically random bytes.
 
std::vector< uint8_t > signet::forge::crypto::detail::pq::random_bytes (size_t size)
 Fill a vector with random bytes.
 
Fe signet::forge::crypto::detail::x25519::fe_from_bytes (const uint8_t *b)
 Load 32 little-endian bytes into a 10-limb field element.
 
void signet::forge::crypto::detail::x25519::fe_carry_10 (Fe &h)
 
Fe signet::forge::crypto::detail::x25519::fe_add (Fe a, const Fe &b)
 
Fe signet::forge::crypto::detail::x25519::fe_sub (Fe a, const Fe &b)
 
Fe signet::forge::crypto::detail::x25519::fe_mul (const Fe &f, const Fe &g)
 
Fe signet::forge::crypto::detail::x25519::fe_sq (const Fe &a)
 
void signet::forge::crypto::detail::x25519::fe_to_bytes (uint8_t *out, Fe h)
 
void signet::forge::crypto::detail::x25519::fe_cswap (Fe &a, Fe &b, uint64_t swap)
 
Fe signet::forge::crypto::detail::x25519::fe_inv (const Fe &z)
 
std::array< uint8_t, 32 > signet::forge::crypto::detail::x25519::clamp_scalar (std::array< uint8_t, 32 > k)
 Clamp a 32-byte scalar per RFC 7748 ยง5.
 
std::array< uint8_t, 32 > signet::forge::crypto::detail::x25519::x25519_raw (const std::array< uint8_t, 32 > &scalar, const std::array< uint8_t, 32 > &point_u)
 X25519 scalar multiplication: result = scalar * point.
 
expected< std::array< uint8_t, 32 > > signet::forge::crypto::detail::x25519::x25519 (const std::array< uint8_t, 32 > &scalar, const std::array< uint8_t, 32 > &u_coord)
 Compute X25519(scalar, u_coord).
 
const std::array< uint8_t, 32 > & signet::forge::crypto::detail::x25519::base_point ()
 The X25519 base point u=9, encoded as 32 LE bytes.
 
expected< std::pair< std::array< uint8_t, 32 >, std::array< uint8_t, 32 > > > signet::forge::crypto::detail::x25519::generate_keypair ()
 Generate a new X25519 keypair.
 

Detailed Description

Post-quantum cryptography: Kyber-768 KEM, Dilithium-3 signatures, X25519 ECDH, and HybridKem (Kyber+X25519) for Parquet encryption.

Definition in file post_quantum.hpp.