Struct desfire::cipher_provider
Defined in File cipher_provider.hpp
Inheritance Relationships
Derived Type
public desfire::typed_cipher_provider< CryptoDES, Crypto2K3DES, Crypto3K3DES, CryptoAES, ProtocolDES, Protocol2K3DES, Protocol3K3DES, ProtocolAES >
(Template Struct desfire::typed_cipher_provider)
Struct Documentation
-
struct cipher_provider
Class that abstracts providing a protocol and a crypto for a
key
. This is used to erase or hide the implementation from the user, so that we can have multiple architectures or multiple backend crypto libraries. It is meant to be used through typed_cipher_provider.Public Functions
-
virtual std::unique_ptr<protocol> protocol_from_key(any_key const &key) = 0
Create the protocol associated to the given
key
.- Parameters:
key – Any key.
- Returns:
A unique pointer to a protocol which is setup with
key
.
-
virtual std::unique_ptr<crypto> crypto_from_key(any_key const &key) = 0
Create the crypto object associated to the given
key
- Parameters:
key – Any key.
- Returns:
A unique pointer to a crypto object on which crypto::setup_with_key has been called.
-
virtual ~cipher_provider() = default
Public Static Functions
-
static std::unique_ptr<cipher_provider> platform_default()
Generate a new platform default cipher provider. For ESP32, this is desfire::esp32::default_cipher_provider.
- Returns:
A new instance of a cipher provider.
-
virtual std::unique_ptr<protocol> protocol_from_key(any_key const &key) = 0