Template Class desfire::key_storage< KeyLength, false >
Defined in File keys.hpp
Inheritance Relationships
Base Type
private desfire::key_storage< KeyLength, true >
(Template Class desfire::key_storage< KeyLength, true >)
Class Documentation
-
template<std::size_t KeyLength>
class key_storage<KeyLength, false> : private desfire::key_storage<KeyLength, true> Mixin used for holding the key body where the version is stored as a separate byte.
See also
Note
This is also used to provide most of the methods key_base.
- Template Parameters:
KeyLength – Length of the key.
Public Types
-
using key_body_t = typename key_storage<KeyLength, true>::key_body_t
Key body alias.
Public Functions
-
constexpr key_storage() = default
Constructs a key filled with zeroes and version 0.
-
explicit key_storage(random_oracle rng, std::uint8_t v = 0)
Constructs a random key body with a pre-defined version.
- Parameters:
rng – Random number generator function to use for filling the key body.
v – Version of this key.
-
explicit constexpr key_storage(key_body_t k, std::uint8_t v = 0)
Constructs a key storage containing the given key body
k
and the versionv
.- Parameters:
k – Key body.
v – Version.
-
constexpr std::uint8_t version() const
Version of the key.
Note
This deliberately shadows its private base class’s member.
- Returns:
A number in the range 0..255 (included).
-
inline void set_version(std::uint8_t v)
Changes the key version to
v
.Note
This deliberately shadows its private base class’s member.
- Parameters:
v – A byte.
-
void randomize(random_oracle rng)
Randomizes the key without changing version.
Note
This deliberately shadows its private base class’s member.
- Parameters:
rng – Random number generator function to use for filling the key body.