Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Botan::XMSS_WOTS_PublicKey Class Reference

`#include <xmss_wots_publickey.h>`

Inheritance diagram for Botan::XMSS_WOTS_PublicKey:

## Classes
class | TreeSignature

## Public Member Functions
std::string | algo_name () const override
AlgorithmIdentifier | algorithm_identifier () const override
bool | check_key (RandomNumberGenerator &, bool) const override
virtual std::unique_ptr< PK_Ops::Encryption > | create_encryption_op (RandomNumberGenerator &rng, const std::string &params, const std::string &provider) const
virtual std::unique_ptr< PK_Ops::KEM_Encryption > | create_kem_encryption_op (RandomNumberGenerator &rng, const std::string &params, const std::string &provider) const
virtual std::unique_ptr< PK_Ops::Verification > | create_verification_op (const std::string &params, const std::string &provider) const
virtual Signature_Format | default_x509_signature_format () const
size_t | estimated_strength () const override
std::string | fingerprint_public (const std::string &alg="SHA-256") const
virtual OID | get_oid () const
const wots_keysig_t & | key_data () const
wots_keysig_t & | key_data ()
size_t | key_length () const override
virtual size_t | message_part_size () const
virtual size_t | message_parts () const
| operator const wots_keysig_t & () const
| operator wots_keysig_t & ()
bool | operator!= (const XMSS_WOTS_PublicKey &key)
bool | operator== (const XMSS_WOTS_PublicKey &key)
const secure_vector< uint8_t > & | operator[] (size_t i) const
secure_vector< uint8_t > & | operator[] (size_t i)
std::vector< uint8_t > | public_key_bits () const override
const secure_vector< uint8_t > & | public_seed () const
secure_vector< uint8_t > & | public_seed ()
void | set_key_data (const wots_keysig_t &key_data)
void | set_key_data (wots_keysig_t &&key_data)
void | set_public_seed (const secure_vector< uint8_t > &public_seed)
void | set_public_seed (secure_vector< uint8_t > &&public_seed)
std::vector< uint8_t > | subject_public_key () const
const XMSS_WOTS_Parameters & | wots_parameters () const
| XMSS_WOTS_PublicKey (XMSS_WOTS_Parameters::ots_algorithm_t oid)
| XMSS_WOTS_PublicKey (XMSS_WOTS_Parameters::ots_algorithm_t oid, RandomNumberGenerator &rng)
| XMSS_WOTS_PublicKey (XMSS_WOTS_Parameters::ots_algorithm_t oid, secure_vector< uint8_t > public_seed)
| XMSS_WOTS_PublicKey (XMSS_WOTS_Parameters::ots_algorithm_t oid, secure_vector< uint8_t > &&public_seed, wots_keysig_t &&key)
| XMSS_WOTS_PublicKey (XMSS_WOTS_Parameters::ots_algorithm_t oid, const secure_vector< uint8_t > &public_seed, const wots_keysig_t &key)
| XMSS_WOTS_PublicKey (XMSS_WOTS_Parameters::ots_algorithm_t oid, const secure_vector< uint8_t > &msg, const wots_keysig_t &sig, XMSS_Address &adrs, const secure_vector< uint8_t > &public_seed)

## Protected Member Functions
void | chain (secure_vector< uint8_t > &x, size_t start_idx, size_t steps, XMSS_Address &adrs, const secure_vector< uint8_t > &public_seed, XMSS_Hash &hash)
void | chain (secure_vector< uint8_t > &x, size_t start_idx, size_t steps, XMSS_Address &adrs, const secure_vector< uint8_t > &public_seed)

## Protected Attributes
XMSS_Hash | m_hash
wots_keysig_t | m_key
secure_vector< uint8_t > | m_public_seed
XMSS_WOTS_Parameters | m_wots_params

## Detailed Description

A Winternitz One Time Signature public key for use with Extended Hash-Based Signatures.

Definition at line 32 of file xmss_wots_publickey.h.

## Constructor & Destructor Documentation

Botan::XMSS_WOTS_PublicKey::XMSS_WOTS_PublicKey | ( | XMSS_WOTS_Parameters::ots_algorithm_t | oid | ) |
| inline

Creates a XMSS_WOTS_PublicKey for the signature method identified by oid. The public seed for this key will be initialized with a uniformly random n-byte value, where "n" is the element size of the selected signature method.

Parameters

  oid | Identifier for the selected signature method.

Definition at line 84 of file xmss_wots_publickey.h.

85 : m_wots_params(oid),
86 m_hash(m_wots_params.hash_function_name()) {}
Botan::XMSS_WOTS_PublicKey::m_hash
XMSS_Hash m_hash
Definition: xmss_wots_publickey.h:326
Botan::XMSS_WOTS_PublicKey::m_wots_params
XMSS_WOTS_Parameters m_wots_params
Definition: xmss_wots_publickey.h:325
Botan::XMSS_WOTS_Parameters::hash_function_name
const std::string & hash_function_name() const
Definition: xmss_wots_parameters.h:67

Botan::XMSS_WOTS_PublicKey::XMSS_WOTS_PublicKey | ( | XMSS_WOTS_Parameters::ots_algorithm_t | oid,
|  | RandomNumberGenerator & | rng
| ) |  |
| inline

Creates a XMSS_WOTS_PublicKey for the signature method identified by oid. The public seed for this key will be initialized with a uniformly random n-byte value, where "n" is the element size of the selected signature method.

Parameters

  oid | Identifier for the selected signature method.
  rng | A random number generate used to generate the public seed.

Definition at line 97 of file xmss_wots_publickey.h.

99 : m_wots_params(oid),
100 m_hash(m_wots_params.hash_function_name()),
101 m_public_seed(rng.random_vec(m_wots_params.element_size())) {}
Botan::XMSS_WOTS_PublicKey::m_public_seed
secure_vector< uint8_t > m_public_seed
Definition: xmss_wots_publickey.h:328
Botan::XMSS_WOTS_Parameters::element_size
size_t element_size() const
Definition: xmss_wots_parameters.h:79
Botan::XMSS_WOTS_PublicKey::m_hash
XMSS_Hash m_hash
Definition: xmss_wots_publickey.h:326
Botan::XMSS_WOTS_PublicKey::m_wots_params
XMSS_WOTS_Parameters m_wots_params
Definition: xmss_wots_publickey.h:325
Botan::XMSS_WOTS_Parameters::hash_function_name
const std::string & hash_function_name() const
Definition: xmss_wots_parameters.h:67

Botan::XMSS_WOTS_PublicKey::XMSS_WOTS_PublicKey | ( | XMSS_WOTS_Parameters::ots_algorithm_t | oid,
|  | secure_vector< uint8_t > | public_seed
| ) |  |
| inline

Creates a XMSS_WOTS_PrivateKey for the signature method identified by oid, with a precomputed public seed.

Parameters

  oid | Identifier for the selected signature method.
  public_seed | A precomputed public seed of n-bytes length.

Definition at line 110 of file xmss_wots_publickey.h.

112 : m_wots_params(oid),
113 m_hash(m_wots_params.hash_function_name()),
114 m_public_seed(public_seed) {}
Botan::XMSS_WOTS_PublicKey::m_public_seed
secure_vector< uint8_t > m_public_seed
Definition: xmss_wots_publickey.h:328
Botan::XMSS_WOTS_PublicKey::public_seed
const secure_vector< uint8_t > & public_seed() const
Definition: xmss_wots_publickey.h:201
Botan::XMSS_WOTS_PublicKey::m_hash
XMSS_Hash m_hash
Definition: xmss_wots_publickey.h:326
Botan::XMSS_WOTS_PublicKey::m_wots_params
XMSS_WOTS_Parameters m_wots_params
Definition: xmss_wots_publickey.h:325
Botan::XMSS_WOTS_Parameters::hash_function_name
const std::string & hash_function_name() const
Definition: xmss_wots_parameters.h:67

Botan::XMSS_WOTS_PublicKey::XMSS_WOTS_PublicKey | ( | XMSS_WOTS_Parameters::ots_algorithm_t | oid,
|  | secure_vector< uint8_t > && | public_seed,
|  | wots_keysig_t && | key
| ) |  |
| inline

Creates a XMSS_WOTS_PublicKey for the signature method identified by oid. The public seed will be initialized with a precomputed seed and and precomputed key data which should be derived from a XMSS_WOTS_PrivateKey.

Parameters

  oid | Ident:s/ifier for the selected signature methods.
  public_seed | A precomputed public seed of n-bytes length.
  key | Precomputed raw key data of the XMSS_WOTS_PublicKey.

Definition at line 126 of file xmss_wots_publickey.h.

129 : m_wots_params(oid),
130 m_hash(m_wots_params.hash_function_name()),
131 m_key(std::move(key)),
132 m_public_seed(std::move(public_seed))
133 {}
Botan::XMSS_WOTS_PublicKey::m_public_seed
secure_vector< uint8_t > m_public_seed
Definition: xmss_wots_publickey.h:328
Botan::XMSS_WOTS_PublicKey::public_seed
const secure_vector< uint8_t > & public_seed() const
Definition: xmss_wots_publickey.h:201
Botan::XMSS_WOTS_PublicKey::m_hash
XMSS_Hash m_hash
Definition: xmss_wots_publickey.h:326
Botan::XMSS_WOTS_PublicKey::m_key
wots_keysig_t m_key
Definition: xmss_wots_publickey.h:327
Botan::XMSS_WOTS_PublicKey::m_wots_params
XMSS_WOTS_Parameters m_wots_params
Definition: xmss_wots_publickey.h:325
Botan::XMSS_WOTS_Parameters::hash_function_name
const std::string & hash_function_name() const
Definition: xmss_wots_parameters.h:67

Botan::XMSS_WOTS_PublicKey::XMSS_WOTS_PublicKey | ( | XMSS_WOTS_Parameters::ots_algorithm_t | oid,
|  | const secure_vector< uint8_t > & | public_seed,
|  | const wots_keysig_t & | key
| ) |  |
| inline

Creates a XMSS_WOTS_PublicKey for the signature method identified by oid. The public seed will be initialized with a precomputed seed and and precomputed key data which should be derived from a XMSS_WOTS_PrivateKey.

Parameters

  oid | Identifier for the selected signature methods.
  public_seed | A precomputed public seed of n-bytes length.
  key | Precomputed raw key data of the XMSS_WOTS_PublicKey.

Definition at line 145 of file xmss_wots_publickey.h.

148 : m_wots_params(oid),
149 m_hash(m_wots_params.hash_function_name()),
150 m_key(key),
151 m_public_seed(public_seed)
152 {}
Botan::XMSS_WOTS_PublicKey::m_public_seed
secure_vector< uint8_t > m_public_seed
Definition: xmss_wots_publickey.h:328
Botan::XMSS_WOTS_PublicKey::public_seed
const secure_vector< uint8_t > & public_seed() const
Definition: xmss_wots_publickey.h:201
Botan::XMSS_WOTS_PublicKey::m_hash
XMSS_Hash m_hash
Definition: xmss_wots_publickey.h:326
Botan::XMSS_WOTS_PublicKey::m_key
wots_keysig_t m_key
Definition: xmss_wots_publickey.h:327
Botan::XMSS_WOTS_PublicKey::m_wots_params
XMSS_WOTS_Parameters m_wots_params
Definition: xmss_wots_publickey.h:325
Botan::XMSS_WOTS_Parameters::hash_function_name
const std::string & hash_function_name() const
Definition: xmss_wots_parameters.h:67

Botan::XMSS_WOTS_PublicKey::XMSS_WOTS_PublicKey | ( | XMSS_WOTS_Parameters::ots_algorithm_t | oid,
|  | const secure_vector< uint8_t > & | msg,
|  | const wots_keysig_t & | sig,
|  | XMSS_Address & | adrs,
|  | const secure_vector< uint8_t > & | public_seed
| ) |  |
| inline

Creates a XMSS_WOTS_PublicKey form a message and signature using Algorithm 6 WOTS_pkFromSig defined in the XMSS standard. This overload is used to verify a message using a public key.

Parameters

  oid | WOTSP algorithm identifier.
  msg | A message.
  sig | A WOTS signature for msg.
  adrs | An XMSS_Address.
  public_seed | The public public_seed.

Definition at line 165 of file xmss_wots_publickey.h.

170 : m_wots_params(oid),
171 m_hash(m_wots_params.hash_function_name()),
172 m_key(pub_key_from_signature(msg,
173 sig,
174 adrs,
175 public_seed)),
176 m_public_seed(public_seed)
177 {}
Botan::XMSS_WOTS_PublicKey::m_public_seed
secure_vector< uint8_t > m_public_seed
Definition: xmss_wots_publickey.h:328
Botan::XMSS_WOTS_PublicKey::public_seed
const secure_vector< uint8_t > & public_seed() const
Definition: xmss_wots_publickey.h:201
Botan::XMSS_WOTS_PublicKey::m_hash
XMSS_Hash m_hash
Definition: xmss_wots_publickey.h:326
Botan::XMSS_WOTS_PublicKey::m_key
wots_keysig_t m_key
Definition: xmss_wots_publickey.h:327
Botan::XMSS_WOTS_PublicKey::m_wots_params
XMSS_WOTS_Parameters m_wots_params
Definition: xmss_wots_publickey.h:325
Botan::XMSS_WOTS_Parameters::hash_function_name
const std::string & hash_function_name() const
Definition: xmss_wots_parameters.h:67

## Member Function Documentation

std::string Botan::XMSS_WOTS_PublicKey::algo_name | ( |  | ) | const
| inline override virtual

Get the name of the underlying public key scheme.

Returns
  name of the public key scheme

Implements Botan::Public_Key.

Definition at line 234 of file xmss_wots_publickey.h.

References m_wots_params, and Botan::XMSS_WOTS_Parameters::name().

Referenced by Botan::XMSS_WOTS_Addressed_PublicKey::algo_name().

235 {
236 return m_wots_params.name();
237 }
Botan::XMSS_WOTS_Parameters::name
const std::string & name() const
Definition: xmss_wots_parameters.h:59
Botan::XMSS_WOTS_PublicKey::m_wots_params
XMSS_WOTS_Parameters m_wots_params
Definition: xmss_wots_publickey.h:325

AlgorithmIdentifier Botan::XMSS_WOTS_PublicKey::algorithm_identifier | ( |  | ) | const
| inline override virtual

Returns
  X.509 AlgorithmIdentifier for this key

Implements Botan::Public_Key.

Definition at line 239 of file xmss_wots_publickey.h.

Referenced by Botan::XMSS_WOTS_Addressed_PublicKey::algorithm_identifier().

240 {
241 throw Not_Implemented("No AlgorithmIdentifier available for XMSS-WOTS.");
242 }

void Botan::XMSS_WOTS_PublicKey::chain | ( | secure_vector< uint8_t > & | x,
|  | size_t | start_idx,
|  | size_t | steps,
|  | XMSS_Address & | adrs,
|  | const secure_vector< uint8_t > & | public_seed,
|  | XMSS_Hash & | hash
| ) |  |
| protected

Algorithm 2: Chaining Function.

Takes an n-byte input string and transforms it into a the function result iterating the cryptographic hash function "F" steps times on the input x using the outputs of the PRNG "G".

This overload is used in multithreaded scenarios, where it is required to provide seperate instances of XMSS_Hash to each thread.

Parameters

  [out] | x | An n-byte input string, that will be transformed into the chaining function result.
  | start_idx | The start index.
  | steps | A number of steps.
  | adrs | An OTS Hash Address.
  | public_seed | A public seed.
  | hash | Instance of XMSS_Hash, that may only by the thead executing chain.

Definition at line 16 of file xmss_wots_publickey.cpp.

References Botan::XMSS_Address::bytes(), Botan::XMSS_Hash::f(), Botan::XMSS_Address::Key_Mode, m_wots_params, Botan::XMSS_Address::Mask_Mode, Botan::XMSS_Hash::output_length(), Botan::XMSS_Hash::prf(), Botan::XMSS_Address::set_hash_address(), Botan::XMSS_Address::set_key_mask_mode(), Botan::XMSS_WOTS_Parameters::wots_parameter(), and Botan::xor_buf().

Referenced by chain(), Botan::XMSS_WOTS_PrivateKey::generate_public_key(), and Botan::XMSS_WOTS_PrivateKey::sign().

22 {
23 secure_vector<uint8_t> prf_output(hash.output_length());
24
25 for(size_t i = start_idx;
26 i < (start_idx + steps) && i < m_wots_params.wots_parameter();
27 i++)
28 {
29 adrs.set_hash_address(static_cast<uint32_t>(i));
30
31 //Calculate tmp XOR bitmask
32 adrs.set_key_mask_mode(XMSS_Address::Key_Mask::Mask_Mode);
33 hash.prf(prf_output, seed, adrs.bytes());
34 xor_buf(result, prf_output, result.size());
35
36 // Calculate key
37 adrs.set_key_mask_mode(XMSS_Address::Key_Mask::Key_Mode);
38
39 //Calculate f(key, tmp XOR bitmask)
40 hash.prf(prf_output, seed, adrs.bytes());
41 hash.f(result, prf_output, result);
42 }
43 }
Botan::xor_buf
void xor_buf(uint8_t out[], const uint8_t in[], size_t length)
Definition: mem_ops.h:232
Botan::XMSS_WOTS_Parameters::wots_parameter
size_t wots_parameter() const
Definition: xmss_wots_parameters.h:87
Botan::XMSS_Address::Key_Mask::Mask_Mode
hash
MechanismType hash
Definition: p11_mechanism.cpp:64
Botan::XMSS_WOTS_PublicKey::m_wots_params
XMSS_WOTS_Parameters m_wots_params
Definition: xmss_wots_publickey.h:325
Botan::XMSS_Address::Key_Mask::Key_Mode

void Botan::XMSS_WOTS_PublicKey::chain | ( | secure_vector< uint8_t > & | x,
|  | size_t | start_idx,
|  | size_t | steps,
|  | XMSS_Address & | adrs,
|  | const secure_vector< uint8_t > & | public_seed
| ) |  |
| inline protected

Algorithm 2: Chaining Function.

Takes an n-byte input string and transforms it into a the function result iterating the cryptographic hash function "F" steps times on the input x using the outputs of the PRNG "G".

Parameters

  [out] | x | An n-byte input string, that will be transformed into the chaining function result.
  | start_idx | The start index.
  | steps | A number of steps.
  | adrs | An OTS Hash Address.
  | public_seed | A public seed.

Definition at line 316 of file xmss_wots_publickey.h.

References chain(), and m_hash.

321 {
322 chain(x, start_idx, steps, adrs, public_seed, m_hash);
323 }
Botan::XMSS_WOTS_PublicKey::public_seed
const secure_vector< uint8_t > & public_seed() const
Definition: xmss_wots_publickey.h:201
Botan::XMSS_WOTS_PublicKey::chain
void chain(secure_vector< uint8_t > &x, size_t start_idx, size_t steps, XMSS_Address &adrs, const secure_vector< uint8_t > &public_seed, XMSS_Hash &hash)
Definition: xmss_wots_publickey.cpp:16
Botan::XMSS_WOTS_PublicKey::m_hash
XMSS_Hash m_hash
Definition: xmss_wots_publickey.h:326

bool Botan::XMSS_WOTS_PublicKey::check_key | ( | RandomNumberGenerator & | rng,
|  | bool | strong
| ) |  | const
| inline override virtual

Test the key values for consistency.

Parameters

  rng | rng to use
  strong | whether to perform strong and lengthy version of the test

Returns
  true if the test is passed

Implements Botan::Public_Key.

Definition at line 244 of file xmss_wots_publickey.h.

Referenced by Botan::XMSS_WOTS_Addressed_PublicKey::check_key().

245 {
246 return true;
247 }

std::unique_ptr< PK_Ops::Encryption > Botan::Public_Key::create_encryption_op | ( | RandomNumberGenerator & | rng,
|  | const std::string & | params,
|  | const std::string & | provider
| ) |  | const
| virtual inherited

This is an internal library function exposed on key types. In almost all cases applications should use wrappers in pubkey.h

Return an encryption operation for this key/params or throw

Parameters

  rng | a random number generator. The PK_Op may maintain a reference to the RNG and use it many times. The rng must outlive any operations which reference it.
  params | additional parameters
  provider | the provider to use

Reimplemented in Botan::RSA_PublicKey, Botan::SM2_PublicKey, and Botan::ElGamal_PublicKey.

Definition at line 91 of file pk_keys.cpp.

References Botan::Public_Key::algo_name().

Referenced by Botan::PK_Encryptor_EME::PK_Encryptor_EME().

94 {
95 throw Lookup_Error(algo_name() + " does not support encryption");
96 }
Botan::Public_Key::algo_name
virtual std::string algo_name() const =0

std::unique_ptr< PK_Ops::KEM_Encryption > Botan::Public_Key::create_kem_encryption_op | ( | RandomNumberGenerator & | rng,
|  | const std::string & | params,
|  | const std::string & | provider
| ) |  | const
| virtual inherited

This is an internal library function exposed on key types. In almost all cases applications should use wrappers in pubkey.h

Return a KEM encryption operation for this key/params or throw

Parameters

  rng | a random number generator. The PK_Op may maintain a reference to the RNG and use it many times. The rng must outlive any operations which reference it.
  params | additional parameters
  provider | the provider to use

Reimplemented in Botan::RSA_PublicKey, and Botan::McEliece_PublicKey.

Definition at line 99 of file pk_keys.cpp.

References Botan::Public_Key::algo_name().

Referenced by Botan::PK_KEM_Encryptor::PK_KEM_Encryptor().

102 {
103 throw Lookup_Error(algo_name() + " does not support KEM encryption");
104 }
Botan::Public_Key::algo_name
virtual std::string algo_name() const =0

std::unique_ptr< PK_Ops::Verification > Botan::Public_Key::create_verification_op | ( | const std::string & | params,
|  | const std::string & | provider
| ) |  | const
| virtual inherited

This is an internal library function exposed on key types. In almost all cases applications should use wrappers in pubkey.h

Return a verification operation for this key/params or throw

Parameters

  params | additional parameters
  provider | the provider to use

Reimplemented in Botan::XMSS_PublicKey, Botan::RSA_PublicKey, Botan::ECDSA_PublicKey, Botan::XMSS_WOTS_Addressed_PublicKey, Botan::GOST_3410_PublicKey, Botan::ECGDSA_PublicKey, Botan::ECKCDSA_PublicKey, Botan::SM2_PublicKey, Botan::Ed25519_PublicKey, and Botan::DSA_PublicKey.

Definition at line 107 of file pk_keys.cpp.

References Botan::Public_Key::algo_name().

Referenced by Botan::XMSS_WOTS_Addressed_PublicKey::create_verification_op(), and Botan::PK_Verifier::PK_Verifier().

109 {
110 throw Lookup_Error(algo_name() + " does not support verification");
111 }
Botan::Public_Key::algo_name
virtual std::string algo_name() const =0

virtual Signature_Format Botan::Public_Key::default_x509_signature_format | ( |  | ) | const
| inline virtual inherited

Reimplemented in Botan::GOST_3410_PublicKey.

Definition at line 126 of file pk_keys.h.

References Botan::DER_SEQUENCE, and Botan::IEEE_1363.

Referenced by Botan::X509_Object::choose_sig_format(), and Botan::X509_Object::verify_signature().

127 {
128 return (this->message_parts() >= 2) ? DER_SEQUENCE : IEEE_1363;
129 }
Botan::Public_Key::message_parts
virtual size_t message_parts() const
Definition: pk_keys.h:113
Botan::IEEE_1363
Definition: pk_keys.h:24
Botan::DER_SEQUENCE
Definition: pk_keys.h:24

size_t Botan::XMSS_WOTS_PublicKey::estimated_strength | ( |  | ) | const
| inline override virtual

Return the estimated strength of the underlying key against the best currently known attack. Note that this ignores anything but pure attacks against the key itself and do not take into account padding schemes, usage mistakes, etc which might reduce the strength. However it does suffice to provide an upper bound.

Returns
  estimated strength in bits

Implements Botan::Public_Key.

Definition at line 249 of file xmss_wots_publickey.h.

References Botan::XMSS_WOTS_Parameters::estimated_strength(), and m_wots_params.

Referenced by Botan::XMSS_WOTS_Addressed_PublicKey::estimated_strength(), and Botan::XMSS_WOTS_Addressed_PublicKey::key_length().

250 {
251 return m_wots_params.estimated_strength();
252 }
Botan::XMSS_WOTS_Parameters::estimated_strength
size_t estimated_strength() const
Definition: xmss_wots_parameters.h:99
Botan::XMSS_WOTS_PublicKey::m_wots_params
XMSS_WOTS_Parameters m_wots_params
Definition: xmss_wots_publickey.h:325

std::string Botan::Public_Key::fingerprint_public | ( | const std::string & | alg = `"SHA-256"` | ) | const
| inherited

Returns
  Hash of the subject public key

Definition at line 77 of file pk_keys.cpp.

References Botan::create_hex_fingerprint(), and Botan::Public_Key::subject_public_key().

78 {
79 return create_hex_fingerprint(subject_public_key(), hash_algo);
80 }
hash_algo
AlgorithmIdentifier hash_algo
Definition: x509_obj.cpp:22
Botan::create_hex_fingerprint
std::string create_hex_fingerprint(const uint8_t bits[], size_t bits_len, const std::string &hash_name)
Definition: pk_keys.cpp:17
Botan::Public_Key::subject_public_key
std::vector< uint8_t > subject_public_key() const
Definition: pk_keys.cpp:38

OID Botan::Public_Key::get_oid | ( |  | ) | const
| virtual inherited

Get the OID of the underlying public key scheme.

Returns
  OID of the public key scheme

Reimplemented in Botan::XMSS_WOTS_Addressed_PublicKey.

Definition at line 53 of file pk_keys.cpp.

References Botan::Public_Key::algo_name(), Botan::OID::empty(), and Botan::OIDS::str2oid_or_empty().

Referenced by Botan::DL_Scheme_PublicKey::algorithm_identifier(), Botan::Curve25519_PublicKey::algorithm_identifier(), Botan::Ed25519_PublicKey::algorithm_identifier(), Botan::McEliece_PublicKey::algorithm_identifier(), Botan::RSA_PublicKey::algorithm_identifier(), Botan::GOST_3410_PublicKey::algorithm_identifier(), Botan::EC_PublicKey::algorithm_identifier(), Botan::TPM_PrivateKey::algorithm_identifier(), and Botan::XMSS_WOTS_Addressed_PublicKey::get_oid().

54 {
55 const OID o = OIDS::str2oid_or_empty(algo_name());
56 if(o.empty())
57 throw Lookup_Error("PK algo " + algo_name() + " has no defined OIDs");
58 return o;
59 }
Botan::Public_Key::algo_name
virtual std::string algo_name() const =0
Botan::OIDS::str2oid_or_empty
BOTAN_UNSTABLE_API OID str2oid_or_empty(const std::string &name)
Definition: oids.cpp:116

const wots_keysig_t& Botan::XMSS_WOTS_PublicKey::key_data | ( |  | ) | const
| inline

Definition at line 215 of file xmss_wots_publickey.h.

References m_key.

Referenced by set_key_data().

215 { return m_key; }
Botan::XMSS_WOTS_PublicKey::m_key
wots_keysig_t m_key
Definition: xmss_wots_publickey.h:327

wots_keysig_t& Botan::XMSS_WOTS_PublicKey::key_data | ( |  | ) |
| inline

Definition at line 217 of file xmss_wots_publickey.h.

References m_key.

217 { return m_key; }
Botan::XMSS_WOTS_PublicKey::m_key
wots_keysig_t m_key
Definition: xmss_wots_publickey.h:327

size_t Botan::XMSS_WOTS_PublicKey::key_length | ( |  | ) | const
| inline override virtual

Return an integer value best approximating the length of the primary security parameter. For example for RSA this will be the size of the modulus, for ECDSA the size of the ECC group, and for McEliece the size of the code will be returned.

Implements Botan::Public_Key.

Definition at line 254 of file xmss_wots_publickey.h.

References Botan::XMSS_WOTS_Parameters::estimated_strength(), and m_wots_params.

255 {
256 return m_wots_params.estimated_strength();
257 }
Botan::XMSS_WOTS_Parameters::estimated_strength
size_t estimated_strength() const
Definition: xmss_wots_parameters.h:99
Botan::XMSS_WOTS_PublicKey::m_wots_params
XMSS_WOTS_Parameters m_wots_params
Definition: xmss_wots_publickey.h:325

virtual size_t Botan::Public_Key::message_part_size | ( |  | ) | const
| inline virtual inherited

Returns how large each of the message parts refered to by message_parts() is

This function is public but applications should have few reasons to ever call this.

Returns
  size of the message parts in bits

Reimplemented in Botan::ECDSA_PublicKey, Botan::GOST_3410_PublicKey, Botan::ECGDSA_PublicKey, Botan::ECKCDSA_PublicKey, Botan::SM2_PublicKey, and Botan::DSA_PublicKey.

Definition at line 124 of file pk_keys.h.

Referenced by Botan::PK_Signer::PK_Signer(), and Botan::PK_Verifier::PK_Verifier().

124 { return 0; }

virtual size_t Botan::Public_Key::message_parts | ( |  | ) | const
| inline virtual inherited

Returns more than 1 if the output of this algorithm (ciphertext, signature) should be treated as more than one value. This is used for algorithms like DSA and ECDSA, where the (r,s) output pair can be encoded as either a plain binary list or a TLV tagged DER encoding depending on the protocol.

This function is public but applications should have few reasons to ever call this.

Returns
  number of message parts

Reimplemented in Botan::ECDSA_PublicKey, Botan::GOST_3410_PublicKey, Botan::ECGDSA_PublicKey, Botan::ECKCDSA_PublicKey, Botan::SM2_PublicKey, and Botan::DSA_PublicKey.

Definition at line 113 of file pk_keys.h.

Referenced by Botan::PK_Signer::PK_Signer(), and Botan::PK_Verifier::PK_Verifier().

113 { return 1; }

Botan::XMSS_WOTS_PublicKey::operator const wots_keysig_t & | ( |  | ) | const
| inline

Convert the key into the raw key data. The key becomes a length len vector of n-byte elements.

Definition at line 193 of file xmss_wots_publickey.h.

References m_key.

193 { return m_key; }
Botan::XMSS_WOTS_PublicKey::m_key
wots_keysig_t m_key
Definition: xmss_wots_publickey.h:327

Botan::XMSS_WOTS_PublicKey::operator wots_keysig_t & | ( |  | ) |
| inline

Convert the key into the raw key data. The key becomes a length len vector of n-byte elements.

Definition at line 199 of file xmss_wots_publickey.h.

References m_key.

199 { return m_key; }
Botan::XMSS_WOTS_PublicKey::m_key
wots_keysig_t m_key
Definition: xmss_wots_publickey.h:327

bool Botan::XMSS_WOTS_PublicKey::operator!= | ( | const XMSS_WOTS_PublicKey & | key | ) |
| inline

Definition at line 269 of file xmss_wots_publickey.h.

270 {
271 return !(*this == key);
272 }

bool Botan::XMSS_WOTS_PublicKey::operator== | ( | const XMSS_WOTS_PublicKey & | key | ) |
| inline

Definition at line 264 of file xmss_wots_publickey.h.

References m_key.

265 {
266 return m_key == key.m_key;
267 }
Botan::XMSS_WOTS_PublicKey::m_key
wots_keysig_t m_key
Definition: xmss_wots_publickey.h:327

const secure_vector<uint8_t>& Botan::XMSS_WOTS_PublicKey::operator[] | ( | size_t | i | ) | const
| inline

Retrieves the i-th element out of the length len chain of n-byte elements contained in the public key.

Parameters

  i | index of the element.

Returns
  n-byte element addressed by i.

Definition at line 186 of file xmss_wots_publickey.h.

References m_key.

186 { return m_key[i]; }
Botan::XMSS_WOTS_PublicKey::m_key
wots_keysig_t m_key
Definition: xmss_wots_publickey.h:327

secure_vector<uint8_t>& Botan::XMSS_WOTS_PublicKey::operator[] | ( | size_t | i | ) |
| inline

Definition at line 187 of file xmss_wots_publickey.h.

References m_key.

187 { return m_key[i]; }
Botan::XMSS_WOTS_PublicKey::m_key
wots_keysig_t m_key
Definition: xmss_wots_publickey.h:327

std::vector<uint8_t> Botan::XMSS_WOTS_PublicKey::public_key_bits | ( |  | ) | const
| inline override virtual

Returns
  BER encoded public key bits

Implements Botan::Public_Key.

Definition at line 259 of file xmss_wots_publickey.h.

Referenced by Botan::XMSS_WOTS_Addressed_PublicKey::public_key_bits().

260 {
261 throw Not_Implemented("No key format defined for XMSS-WOTS");
262 }

const secure_vector<uint8_t>& Botan::XMSS_WOTS_PublicKey::public_seed | ( |  | ) | const
| inline

Definition at line 201 of file xmss_wots_publickey.h.

References m_public_seed.

Referenced by Botan::XMSS_WOTS_PrivateKey::generate_public_key(), and set_public_seed().

201 { return m_public_seed; }
Botan::XMSS_WOTS_PublicKey::m_public_seed
secure_vector< uint8_t > m_public_seed
Definition: xmss_wots_publickey.h:328

secure_vector<uint8_t>& Botan::XMSS_WOTS_PublicKey::public_seed | ( |  | ) |
| inline

Definition at line 203 of file xmss_wots_publickey.h.

References m_public_seed.

203 { return m_public_seed; }
Botan::XMSS_WOTS_PublicKey::m_public_seed
secure_vector< uint8_t > m_public_seed
Definition: xmss_wots_publickey.h:328

void Botan::XMSS_WOTS_PublicKey::set_key_data | ( | const wots_keysig_t & | key_data | ) |
| inline

Definition at line 219 of file xmss_wots_publickey.h.

References key_data(), and m_key.

Referenced by Botan::XMSS_WOTS_PrivateKey::generate_public_key(), and Botan::XMSS_WOTS_PrivateKey::XMSS_WOTS_PrivateKey().

220 {
221 m_key = key_data;
222 }
Botan::XMSS_WOTS_PublicKey::m_key
wots_keysig_t m_key
Definition: xmss_wots_publickey.h:327
Botan::XMSS_WOTS_PublicKey::key_data
const wots_keysig_t & key_data() const
Definition: xmss_wots_publickey.h:215

void Botan::XMSS_WOTS_PublicKey::set_key_data | ( | wots_keysig_t && | key_data | ) |
| inline

Definition at line 224 of file xmss_wots_publickey.h.

References key_data(), and m_key.

225 {
226 m_key = std::move(key_data);
227 }
Botan::XMSS_WOTS_PublicKey::m_key
wots_keysig_t m_key
Definition: xmss_wots_publickey.h:327
Botan::XMSS_WOTS_PublicKey::key_data
const wots_keysig_t & key_data() const
Definition: xmss_wots_publickey.h:215

void Botan::XMSS_WOTS_PublicKey::set_public_seed | ( | const secure_vector< uint8_t > & | public_seed | ) |
| inline

Definition at line 205 of file xmss_wots_publickey.h.

References m_public_seed, and public_seed().

206 {
207 m_public_seed = public_seed;
208 }
Botan::XMSS_WOTS_PublicKey::m_public_seed
secure_vector< uint8_t > m_public_seed
Definition: xmss_wots_publickey.h:328
Botan::XMSS_WOTS_PublicKey::public_seed
const secure_vector< uint8_t > & public_seed() const
Definition: xmss_wots_publickey.h:201

void Botan::XMSS_WOTS_PublicKey::set_public_seed | ( | secure_vector< uint8_t > && | public_seed | ) |
| inline

Definition at line 210 of file xmss_wots_publickey.h.

References m_public_seed, and public_seed().

211 {
212 m_public_seed = std::move(public_seed);
213 }
Botan::XMSS_WOTS_PublicKey::m_public_seed
secure_vector< uint8_t > m_public_seed
Definition: xmss_wots_publickey.h:328
Botan::XMSS_WOTS_PublicKey::public_seed
const secure_vector< uint8_t > & public_seed() const
Definition: xmss_wots_publickey.h:201

std::vector< uint8_t > Botan::Public_Key::subject_public_key | ( |  | ) | const
| inherited

Returns
  X.509 subject key encoding for this key object

Definition at line 38 of file pk_keys.cpp.

References Botan::Public_Key::algorithm_identifier(), Botan::BIT_STRING, Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), Botan::Public_Key::public_key_bits(), Botan::SEQUENCE, and Botan::DER_Encoder::start_cons().

Referenced by Botan::X509::BER_encode(), Botan::PKCS10_Request::create(), Botan::Public_Key::fingerprint_public(), and Botan::X509::PEM_encode().

39 {
40 std::vector<uint8_t> output;
41
42 DER_Encoder(output).start_cons(SEQUENCE)
43 .encode(algorithm_identifier())
44 .encode(public_key_bits(), BIT_STRING)
45 .end_cons();
46
47 return output;
48 }
Botan::Public_Key::public_key_bits
virtual std::vector< uint8_t > public_key_bits() const =0
Botan::Public_Key::algorithm_identifier
virtual AlgorithmIdentifier algorithm_identifier() const =0
Botan::SEQUENCE
Definition: asn1_obj.h:40
Botan::BIT_STRING
Definition: asn1_obj.h:35

const XMSS_WOTS_Parameters& Botan::XMSS_WOTS_PublicKey::wots_parameters | ( |  | ) | const
| inline

Definition at line 229 of file xmss_wots_publickey.h.

References m_wots_params.

Referenced by Botan::XMSS_WOTS_PrivateKey::generate_public_key().

230 {
231 return m_wots_params;
232 }
Botan::XMSS_WOTS_PublicKey::m_wots_params
XMSS_WOTS_Parameters m_wots_params
Definition: xmss_wots_publickey.h:325

## Member Data Documentation

XMSS_Hash Botan::XMSS_WOTS_PublicKey::m_hash
| protected

Definition at line 326 of file xmss_wots_publickey.h.

Referenced by chain(), Botan::XMSS_WOTS_PrivateKey::generate_public_key(), Botan::XMSS_WOTS_PrivateKey::operator[](), and Botan::XMSS_WOTS_PrivateKey::sign().

wots_keysig_t Botan::XMSS_WOTS_PublicKey::m_key
| protected

Definition at line 327 of file xmss_wots_publickey.h.

Referenced by key_data(), operator const wots_keysig_t &(), operator wots_keysig_t &(), operator==(), operator[](), and set_key_data().

secure_vector<uint8_t> Botan::XMSS_WOTS_PublicKey::m_public_seed
| protected

Definition at line 328 of file xmss_wots_publickey.h.

Referenced by public_seed(), set_public_seed(), and Botan::XMSS_WOTS_PrivateKey::sign().

XMSS_WOTS_Parameters Botan::XMSS_WOTS_PublicKey::m_wots_params
| protected

Definition at line 325 of file xmss_wots_publickey.h.

Referenced by algo_name(), Botan::XMSS_WOTS_PrivateKey::at(), chain(), estimated_strength(), Botan::XMSS_WOTS_PrivateKey::generate_public_key(), key_length(), Botan::XMSS_WOTS_PrivateKey::sign(), and wots_parameters().

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

- src/lib/pubkey/xmss/xmss_wots_publickey.h
- src/lib/pubkey/xmss/xmss_wots_publickey.cpp