Botan 3.5.0
Crypto and TLS for C&
kyber_keys.h
Go to the documentation of this file.
1/*
2 * Crystals Kyber Internal Key Types
3 *
4 * (C) 2021-2024 Jack Lloyd
5 * (C) 2021-2022 Manuel Glaser and Michael Boric, Rohde & Schwarz Cybersecurity
6 * (C) 2021-2022 René Meusel and Hannes Rantzsch, neXenio GmbH
7 * (C) 2024 René Meusel, Rohde & Schwarz Cybersecurity
8 *
9 * Botan is released under the Simplified BSD License (see license.txt)
10 */
11
12#ifndef BOTAN_KYBER_INTERNAL_KEYS_H_
13#define BOTAN_KYBER_INTERNAL_KEYS_H_
14
15#include <botan/internal/kyber_constants.h>
16#include <botan/internal/kyber_structures.h>
17#include <botan/internal/kyber_types.h>
18
19namespace Botan {
20
22 public:
24
25 Kyber_PublicKeyInternal(const KyberConstants& mode, std::span<const uint8_t> polynomials, KyberSeedRho seed) :
26 Kyber_PublicKeyInternal(mode, PolynomialVector::from_bytes(polynomials, mode), std::move(seed)) {}
27
29
30 const PolynomialVector& t() const { return m_t; }
31
32 const KyberSeedRho& rho() const { return m_rho; }
33
34 const KyberConstants& mode() const { return m_mode; }
35
36 const KyberSerializedPublicKey& public_key_bits_raw() const { return m_public_key_bits_raw; }
37
38 const KyberHashedPublicKey& H_public_key_bits_raw() const { return m_H_public_key_bits_raw; }
39
41
42 private:
43 const KyberConstants m_mode;
45 const KyberSeedRho m_rho;
46 const KyberSerializedPublicKey m_public_key_bits_raw;
47 const KyberHashedPublicKey m_H_public_key_bits_raw;
48};
49
51 public:
53 m_mode(std::move(mode)), m_s(std::move(s)), m_z(std::move(z)) {}
54
56
57 PolynomialVector& s() { return m_s; }
58
59 const PolynomialVector& s() const { return m_s; }
60
61 const KyberImplicitRejectionValue& z() const { return m_z; }
62
63 const KyberConstants& mode() const { return m_mode; }
64
66
67 private:
68 KyberConstants m_mode;
71};
72
73} // namespace Botan
74
75#endif
const KyberConstants & mode() const
Definition kyber_keys.h:63
KyberMessage indcpa_decrypt(Ciphertext ct) const
PolynomialVector & s()
Definition kyber_keys.h:57
const PolynomialVector & s() const
Definition kyber_keys.h:59
Kyber_PrivateKeyInternal(KyberConstants mode, PolynomialVector s, KyberImplicitRejectionValue z)
Definition kyber_keys.h:52
const KyberImplicitRejectionValue & z() const
Definition kyber_keys.h:61
Kyber_PublicKeyInternal(const KyberConstants &mode, std::span< const uint8_t > polynomials, KyberSeedRho seed)
Definition kyber_keys.h:25
Ciphertext indcpa_encrypt(StrongSpan< const KyberMessage > m, StrongSpan< const KyberEncryptionRandomness > r) const
const KyberHashedPublicKey & H_public_key_bits_raw() const
Definition kyber_keys.h:38
const KyberSeedRho & rho() const
Definition kyber_keys.h:32
const PolynomialVector & t() const
Definition kyber_keys.h:30
const KyberConstants & mode() const
Definition kyber_keys.h:34
const KyberSerializedPublicKey & public_key_bits_raw() const
Definition kyber_keys.h:36