Digital Authentication Framework  6.0.1.37
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BasicKey Class Reference

Base class for simple keys. More...

#include <basic_key.h>

Inheritance diagram for BasicKey:
DAKey BasicReadonlyKey

Public Member Functions

 BasicKey (BasicError &err)
 Constructor. More...
 
DAMetaDatagetInfo ()
 get metadata object describing this key More...
 
virtual bool encrypt (DAMessage &msg)
 Encrypt the given message Returns success = true.
 
virtual bool decrypt (DAMessage &msg)
 Decrypt the given message Returns success = true.
 
virtual bool sign (DAMessage &msg)
 Sign the given message Returns success = true.
 
virtual bool verify (DAMessage &msg)
 Verify the given message Returns success = true.
 
virtual bool setData (const DAData &data)
 Set key data. More...
 
virtual bool getData (DAData &out)
 Retrieve key data. More...
 
virtual bool generateMaterial ()
 Generates or regenerates key material. More...
 
virtual std::vector< DAMechanismgetMechanisms ()
 Return a vector of mechanisms supported by this key.
 
void setSerial (const std::string &serial)
 Set serial number to be returned by metadata.
 
- Public Member Functions inherited from DAKey
virtual ~DAKey ()
 virtual destructor More...
 

Protected Member Functions

bool _notImpl ()
 Stub for not-implemented methods: sets a NOT_IMPLEMENTED error and returns false.
 

Protected Attributes

BasicErrorm_error
 Reference to object where this key can report errors.
 
BasicMetaData m_meta
 Metadata for this key. Subclasses can set fields within this data.
 

Additional Inherited Members

- Static Public Attributes inherited from DAKey
static const int STORAGE_MESSAGE_SIZE = 32
 Size of random data stored for class-1 keys.
 
static const int ENCRYPT_MESSAGE_SIZE = 32
 Size of plaintext message passed to class 2 and 3 encrypt-decrypt keys.
 
static const int ONEWAY_MESSAGE_SIZE = 32
 Size of plaintext message passed to class 2 and 3 MAC/signature keys.
 

Detailed Description

Base class for simple keys.

This contains boiler-plate code for implementing error and DAMetaData handling for keys. Note it is not usable directly, as it provides no working operations.

Constructor & Destructor Documentation

BasicKey::BasicKey ( BasicError err)

Constructor.

Parameters
errreference to the BasicError object for the DASession which contains this key.

Member Function Documentation

virtual bool BasicKey::generateMaterial ( )
virtual

Generates or regenerates key material.

For class-1 keys, this is called during the 'change passphrase' sequence to roll over a key. This should replace the key's current value with new, random data. This method may return a NOT_IMPLEMENTED error, in which case the DAF logic will call setData().

Returns success = true, false if error

Implements DAKey.

virtual bool BasicKey::getData ( DAData data)
virtual

Retrieve key data.

This is only called for class-0 and class-1 keys. Keys capable of cryptographic operation should not implement this.

Returns success = true

Implements DAKey.

Reimplemented in BasicReadonlyKey.

DAMetaData& BasicKey::getInfo ( )
virtual

get metadata object describing this key

Implements DAKey.

virtual bool BasicKey::setData ( const DAData data)
virtual

Set key data.

For class-1 keys, this is called during the 'change 'passphrase' sequence, if generateMaterial() returns a NOT_IMPLEMENTED error. The data to be stored will be 32 bytes (STORAGE_MESSAGE_SIZE) bytes long. If the key cannot store messages of this size, it must implement the generateMaterial() method.

Returns success = true

Implements DAKey.


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