Class desfire::crypto_aes_base
Defined in File crypto.hpp
Inheritance Relationships
Base Type
public desfire::crypto_with_cmac
(Class desfire::crypto_with_cmac)
Derived Type
public desfire::esp32::crypto_aes
(Class desfire::esp32::crypto_aes)
Class Documentation
-
class crypto_aes_base : public desfire::crypto_with_cmac
Base class for a AES128 cryptographic implementation. Inherit from this.
Compared to crypto_with_cmac, this class fixes the cipher_type and provides the implementation of the session key derivation function init_session (which then calls setup_primitives_with_key). Subclasses should then implement only setup_primitives_with_key and do_crypto.
Subclassed by desfire::esp32::crypto_aes
Public Functions
-
crypto_aes_base()
-
inline virtual desfire::cipher_type cipher_type() const final
- Returns:
-
virtual void init_session(range<std::uint8_t const*> random_data) final
Begins a new session by deriving the session key from
random_data
and calling setup_with_key.This method should do the appropriate operations to derive a session key from the data
random_data
which was obtained as a consequence of the key exchange protocol between the two parties. These usually consist in byte shift and rearrangement.Note
Implementations of this method must then call manually setup_with_key in order to complete the session initialization process.
- Parameters:
random_data – Range of bytes containing the random data exchanged by the two parties. This has to be used to derive the session key. This is specified as a range on raw bytes for convenience, as the underlying cryptographic functions are likely low level.
-
crypto_aes_base()