Template Struct desfire::typed_cipher_provider

Inheritance Relationships

Base Type

Struct Documentation

template<class CryptoDES, class Crypto2K3DES, class Crypto3K3DES, class CryptoAES, class ProtocolDES = protocol_legacy, class Protocol2K3DES = protocol_legacy, class Protocol3K3DES = protocol_default, class ProtocolAES = protocol_default>
struct typed_cipher_provider : public desfire::cipher_provider

Subclass which maps a set of crypto classes and protocol classes onto the given cipher_type. This completes type erasure.

Template Parameters:
  • CryptoDES – Crypto class to be used with DES keys.

  • Crypto2K3DES – Crypto class to be used with 2K3DES keys.

  • Crypto3K3DES – Crypto class to be used with 3K3DES keys.

  • CryptoAES – Crypto class to be used with AES keys.

  • ProtocolDES – Protocol to be used with DES keys (default protocol_legacy).

  • Protocol2K3DES – Protocol to be used with 2K3DES keys (default protocol_default).

  • Protocol3K3DES – Protocol to be used with 3K3DES keys (default protocol_default).

  • ProtocolAES – Protocol to be used with AES keys (default protocol_default).

Public Types

using crypto_des = CryptoDES
using crypto_2k3des = Crypto2K3DES
using crypto_3k3des = Crypto3K3DES
using crypto_aes = CryptoAES
using protocol_des = ProtocolDES
using protocol_2k3des = Protocol2K3DES
using protocol_3k3des = Protocol3K3DES
using protocol_aes = ProtocolAES

Public Functions

virtual std::unique_ptr<protocol> protocol_from_key(any_key const &key) override

Default constructs the appropriate crypto based on the specified template parameters, then calls crypto::setup_with_key and returns the appropriate protocol (also based on template parameters) constructed using the crypto object above.

virtual std::unique_ptr<crypto> crypto_from_key(any_key const &key) override

Default constructs the appropriate crypto based on the specified template parameters, then calls crypto::setup_with_key and returns it.

inline crypto_des typed_crypto_from_key(key<cipher_type::des> const &key) const

Default constructs the appropriate crypto based on the specified template parameters, then calls crypto::setup_with_key and returns it.

inline protocol_des typed_protocol_from_key(key<cipher_type::des> const &key) const

Default constructs the appropriate crypto based on the specified template parameters, then calls crypto::setup_with_key and returns the appropriate protocol (also based on template parameters) constructed using the crypto object above.

inline crypto_2k3des typed_crypto_from_key(key<cipher_type::des3_2k> const &key) const

Default constructs the appropriate crypto based on the specified template parameters, then calls crypto::setup_with_key and returns it.

inline protocol_2k3des typed_protocol_from_key(key<cipher_type::des3_2k> const &key) const

Default constructs the appropriate crypto based on the specified template parameters, then calls crypto::setup_with_key and returns the appropriate protocol (also based on template parameters) constructed using the crypto object above.

inline crypto_3k3des typed_crypto_from_key(key<cipher_type::des3_3k> const &key) const

Default constructs the appropriate crypto based on the specified template parameters, then calls crypto::setup_with_key and returns it.

inline protocol_3k3des typed_protocol_from_key(key<cipher_type::des3_3k> const &key) const

Default constructs the appropriate crypto based on the specified template parameters, then calls crypto::setup_with_key and returns the appropriate protocol (also based on template parameters) constructed using the crypto object above.

inline crypto_aes typed_crypto_from_key(key<cipher_type::aes128> const &key) const

Default constructs the appropriate crypto based on the specified template parameters, then calls crypto::setup_with_key and returns it.

inline protocol_aes typed_protocol_from_key(key<cipher_type::aes128> const &key) const

Default constructs the appropriate crypto based on the specified template parameters, then calls crypto::setup_with_key and returns the appropriate protocol (also based on template parameters) constructed using the crypto object above.