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

Simple implementation of DAMetaData. More...

#include <basic_metadata.h>

Inheritance diagram for BasicMetaData:
DAMetaData

Public Types

typedef std::vector< DADataDADataList
 0, 1 or many data items (e.g. an X.509 certificate chain)
 

Public Member Functions

 BasicMetaData (BasicError &err)
 Constructor Produces a metadata container with no values. More...
 
void copyFrom (const DAMetaData &meta)
 Copy data values from another DAMetaData. More...
 
void setString (DAAttrib which, const std::string &value)
 Set a string attribute.
 
void setFlag (DAAttrib which, bool value=true)
 Set a boolean(flag) attribute.
 
void setData (DAAttrib which, const DAData &value)
 Set a (single) byte-block attribute.
 
void setData (DAAttrib which, const DADataList &values)
 Sets a (list of) byte-block attributes.
 
void setSize (DAAttrib which, size_t len)
 Set a size attribute.
 
virtual bool getString (DAAttrib which, std::string &out)
 Get String attribute. More...
 
virtual bool getFlag (DAAttrib which)
 Get boolean attribute. More...
 
virtual bool getData (DAAttrib which, DAData &out, size_t index)
 Get byteblock attribute. More...
 
virtual bool getSize (DAAttrib which, size_t &len_r)
 Get size attribute. More...
 
- Public Member Functions inherited from DAMetaData
virtual ~DAMetaData ()
 Virtual Destructor. More...
 

Protected Types

typedef std::map< DAAttrib, std::string > string_map
 Holds string attributes.
 
typedef std::map< DAAttrib, bool > flag_map
 Holds flag attributes.
 
typedef std::map< DAAttrib, DADataListdata_map
 Holds data attributes.
 
typedef std::map< DAAttrib, size_t > size_map
 Holds data attributes.
 

Protected Attributes

BasicErrorm_error
 Reference to error object to use on failure.
 
string_map m_strings
 Map containing all std::string attribute values.
 
flag_map m_flags
 Map containing all bool attribute values.
 
data_map m_datas
 Map containing all DAData attribute values.
 
size_map m_sizes
 Map containing all DASize attribute values.
 

Detailed Description

Simple implementation of DAMetaData.

Most DAF implementations can use this directly, assuming the metadata values for the object are available at the time that object is created.

Constructor & Destructor Documentation

BasicMetaData::BasicMetaData ( BasicError err)

Constructor Produces a metadata container with no values.

Parameters
erris the error reporting object for the object for which this is the metadata. Must be valid throughout the life of this object.

Member Function Documentation

void BasicMetaData::copyFrom ( const DAMetaData meta)

Copy data values from another DAMetaData.

Parameters
metaMust be a BasicMetaData object (FIXME- fails silently if not)
virtual bool BasicMetaData::getData ( DAAttrib  which,
DAData data,
size_t  index 
)
virtual

Get byteblock attribute.

For DA_CERTIFICATE attributes, index is set to 0 to return the X.509 certificate for the key. If additional certificates are required to validate this, these should be provided for index=1, index=2, and so on. The caller can discover the certificate chain by enumerating successive index values, until the method returns false.

Returns
true if the key has the requested attribute (and data has been set). false if the requested attribute is not present.

Implements DAMetaData.

virtual bool BasicMetaData::getFlag ( DAAttrib  which)
virtual

Get boolean attribute.

Parameters
whichidentifies the flag value to query
Returns
true if the requested flag attribute is present, false if the flag is not set / not present.

Queries whether a particular flag is set. Note that there is no semantic difference between a flag being 'not set' and the flag attribute being 'not present'.

Implements DAMetaData.

virtual bool BasicMetaData::getSize ( DAAttrib  which,
size_t &  len_r 
)
virtual

Get size attribute.

Used with DA_SIGNATURE_SIZE and DA_MAX_DECRYPT_SIZE attributes to return the sizes (in bytes) of signatures and decrypted data, respectively. Keys with DA_SMIME_SIGN or DA_TLS_CLIENT_AUTH flags set must also have a DA_SIGNATURE_SIZE attribute. Keys with DA_SMIME_DECRYPT must have DA_MAX_DECRYPT_SIZE.

Returns
true if the key has the requested size attribute (and len_r must have been set), false if the requested attribute is not present.

Implements DAMetaData.

virtual bool BasicMetaData::getString ( DAAttrib  which,
std::string &  data 
)
virtual

Get String attribute.

Parameters
whichIdentifies the attribute to get
dataOn return, set to the value of the requested attribute.
Returns
true if the key has the requested string attribute (and data has been set). false if the requested attribute is not present.

Implements DAMetaData.


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