Digital Authentication Framework 6.0.1.33
Public Member Functions | Protected Member Functions | Protected Attributes

BasicKey Class Reference

Base class for simple keys. More...

#include <basic_key.h>

Inheritance diagram for BasicKey:
DAKey BasicReadonlyKey

List of all members.

Public Member Functions

 BasicKey (BasicError &err)
 Constructor.
DAMetaDatagetInfo ()
 get metadata object describing this key
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.
virtual bool getData (DAData &out)
 Retrieve key data.
virtual bool generateMaterial ()
 Generates or regenerates key material.
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.

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.

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) [inline]

Constructor.

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

Member Function Documentation

virtual bool BasicKey::generateMaterial ( ) [inline, 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) [inline, 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 ( ) [inline, virtual]

get metadata object describing this key

Implements DAKey.

virtual bool BasicKey::setData ( const DAData data) [inline, 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: