Kinetis Bootloader Host  2.0.0
Host Tools for Kinetis devices
AESKey< S > Class Template Reference

Generic AES key class. More...

#include <AESKey.h>

+ Inheritance diagram for AESKey< S >:
+ Collaboration diagram for AESKey< S >:

Public Types

typedef uint8_t key_t[S/8]
 Type for this size of AES key.
 
typedef uint8_t key_t[S/8]
 Type for this size of AES key.
 

Public Member Functions

 AESKey ()
 Default constructor. More...
 
 AESKey (const key_t &key)
 Constructor taking a key value reference.
 
 AESKey (const key_t *key)
 
 AESKey (std::istream &stream)
 Constructor, reads key from stream in hex format.
 
 AESKey (const AESKey< S > &other)
 Copy constructor.
 
 ~AESKey ()
 Destructor. More...
 
void randomize ()
 Set to the key to a randomly generated value.
 
void readFromStream (std::istream &stream)
 Reads the key from a hex encoded data stream.
 
void writeToStream (std::ostream &stream)
 Writes the key to a data stream in hex encoded format.
 
 AESKey ()
 Default constructor. More...
 
 AESKey (const key_t &key)
 Constructor taking a key value reference.
 
 AESKey (const key_t *key)
 
 AESKey (std::istream &stream)
 Constructor, reads key from stream in hex format.
 
 AESKey (const AESKey< S > &other)
 Copy constructor.
 
 ~AESKey ()
 Destructor. More...
 
void randomize ()
 Set to the key to a randomly generated value.
 
void readFromStream (std::istream &stream)
 Reads the key from a hex encoded data stream.
 
void writeToStream (std::ostream &stream) const
 Writes the key to a data stream in hex encoded format.
 
Key accessors
const key_tgetKey () const
 
void getKey (key_t *key) const
 
void setKey (const key_t &key)
 
void setKey (const key_t *key)
 
void setKey (const AESKey< S > &key)
 
const key_tgetKey () const
 
void getKey (key_t *key) const
 
void setKey (const key_t &key)
 
void setKey (const key_t *key)
 
void setKey (const AESKey< S > &key)
 
- Public Member Functions inherited from AESKeyBase
void _readFromStream (std::istream &stream, unsigned bytes, uint8_t *buffer)
 Reads hex encoded data from stream. More...
 
void _writeToStream (std::ostream &stream, unsigned bytes, const uint8_t *buffer)
 Writes hex encoded data to stream. More...
 
void _readFromStream (std::istream &stream, unsigned bytes, uint8_t *buffer) const
 Reads hex encoded data from stream. More...
 
void _writeToStream (std::ostream &stream, unsigned bytes, const uint8_t *buffer) const
 Writes hex encoded data to stream. More...
 

Protected Attributes

key_t m_key
 The key value.
 

Operators

const AESKey< S > & operator= (const AESKey< S > &key)
 
const AESKey< S > & operator= (const key_t &key)
 
const AESKey< S > & operator= (const key_t *key)
 
 operator const key_t & () const
 
 operator const key_t * () const
 
const AESKey< S > & operator= (const AESKey< S > &key)
 
const AESKey< S > & operator= (const key_t &key)
 
const AESKey< S > & operator= (const key_t *key)
 
 operator const key_t & () const
 
 operator const key_t * () const
 
std::ostream & operator<< (std::ostream &os, const AESKey< S > &key)
 

Detailed Description

template<int S>
class AESKey< S >

Generic AES key class.

The template parameter S is the number of bits in the key.

The underlying key type can be accessed like this: AESKey<128>::key_t

When a key instance is destroyed, it erases the key data by setting it to all zeroes.

AESKey<128> key = AESKey<128>::readFromStream(s);

The template parameter S is the number of bits in the key.

The underlying key type can be accessed like this: AESKey<128>::key_t

When a key instance is destroyed, it erases the key data by setting it to all zeroes.

AESKey<128> key = AESKey<128>::readFromStream(s);

Constructor & Destructor Documentation

template<int S>
AESKey< S >::AESKey ( )
inline

Default constructor.

Initializes the key to 0.

template<int S>
AESKey< S >::~AESKey ( )
inline

Destructor.

Sets the key value to zero.

template<int S>
AESKey< S >::AESKey ( )
inline

Default constructor.

Initializes the key to 0.

template<int S>
AESKey< S >::~AESKey ( )
inline

Destructor.

Sets the key value to zero.


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