14#ifndef BOTAN_KYBER_COMMON_H_
15#define BOTAN_KYBER_COMMON_H_
17#include <botan/exceptn.h>
18#include <botan/pk_keys.h>
22#if !defined(BOTAN_HAS_KYBER_90S) && !defined(BOTAN_HAS_KYBER) && !defined(BOTAN_HAS_ML_KEM)
25 "botan module 'kyber_common' is useful only when enabling at least one of those modules: 'kyber', 'kyber_90s', 'ml_kem'");
57 OID object_identifier()
const;
66 bool is_ml_kem() const;
68 bool is_kyber_round3() const;
70 bool is_available() const;
72 bool operator==(const
KyberMode& other)
const {
return m_mode == other.m_mode; }
91class Kyber_PublicKeyInternal;
92class Kyber_PrivateKeyInternal;
128 std::unique_ptr<PK_Ops::KEM_Encryption> create_kem_encryption_op(std::string_view params,
129 std::string_view provider)
const override;
176 std::unique_ptr<Public_Key>
public_key()
const override;
185 std::string_view params,
186 std::string_view provider)
const override;
211 std::shared_ptr<Kyber_PrivateKeyInternal> m_private;
#define BOTAN_DIAGNOSTIC_POP
#define BOTAN_DIAGNOSTIC_PUSH
#define BOTAN_DIAGNOSTIC_IGNORE_INHERITED_VIA_DOMINANCE
#define BOTAN_PUBLIC_API(maj, min)
#define BOTAN_DEPRECATED(msg)
bool operator!=(const KyberMode &other) const
MlPrivateKeyFormat private_key_format() const
secure_vector< uint8_t > private_key_bits_with_format(MlPrivateKeyFormat format) const
std::unique_ptr< PK_Ops::KEM_Decryption > create_kem_decryption_op(RandomNumberGenerator &rng, std::string_view params, std::string_view provider) const override
std::unique_ptr< Public_Key > public_key() const override
bool check_key(RandomNumberGenerator &rng, bool strong) const override
Kyber_PrivateKey(RandomNumberGenerator &rng, KyberMode mode)
secure_vector< uint8_t > raw_private_key_bits() const override
friend class Kyber_KEM_Decryptor
secure_vector< uint8_t > private_key_bits() const override
Kyber_PublicKey & operator=(const Kyber_PublicKey &other)=default
std::vector< uint8_t > public_key_bits() const override
std::vector< uint8_t > raw_public_key_bits() const override
bool check_key(RandomNumberGenerator &rng, bool strong) const override
std::string algo_name() const override
std::shared_ptr< Kyber_PublicKeyInternal > m_public
friend class Kyber_KEM_Encryptor
size_t key_length() const override
AlgorithmIdentifier algorithm_identifier() const override
Kyber_PublicKey()=default
~Kyber_PublicKey() override=default
static std::shared_ptr< Kyber_PublicKeyInternal > initialize_from_encoding(std::span< const uint8_t > pub_key, KyberMode m)
bool supports_operation(PublicKeyOperation op) const override
OID object_identifier() const override
friend class Kyber_KEM_Decryptor
std::unique_ptr< Private_Key > generate_another(RandomNumberGenerator &rng) const final
Kyber_PublicKey(std::span< const uint8_t > pub_key, KyberMode mode)
size_t estimated_strength() const override
std::vector< T, secure_allocator< T > > secure_vector
std::string to_string(ErrorType type)
Convert an ErrorType to string.
MlPrivateKeyFormat
Byte encoding format of ML-KEM and ML-DSA the private key.
@ Expanded
The expanded format, i.e., the format specified in FIPS-203/204.