AttributeContainer Class Reference

Collaboration diagram for AttributeContainer:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class is a generic searchable container for cryptoki attributes that might be substitutable by a multi-map. Many of the method's are overloaded so that the compiler can determine which set of functions should be called for the DER encoding. Oh yeah, all attribtues added will be DER encoded and saved


Public Member Functions

 AttributeContainer (void)
 ~AttributeContainer (void)
CK_ATTRIBUTE * getAttribute (CK_ATTRIBUTE_TYPE type)
map< CK_ATTRIBUTE_TYPE, CK_ATTRIBUTE * > getAttributes ()
CK_ATTRIBUTE * addAttribute (CK_ATTRIBUTE_TYPE type, void *value, size_t size)
CK_ATTRIBUTE * addAttribute (CK_ATTRIBUTE_TYPE type, X509_NAME *name)
CK_ATTRIBUTE * addAttribute (CK_ATTRIBUTE_TYPE type, ASN1_STRING *string)
CK_ATTRIBUTE * addAttribute (CK_ATTRIBUTE_TYPE type, CK_DATE *date, ASN1_STRING *str)
CK_ATTRIBUTE * addAttribute (CK_ATTRIBUTE_TYPE type, BIGNUM *num)
CK_ATTRIBUTE * addAttribute (CK_ATTRIBUTE_TYPE type, X509 *x509)
void clear ()


Constructor & Destructor Documentation

AttributeContainer::AttributeContainer void   ) 
 

All attribute containers start out empty

AttributeContainer::~AttributeContainer void   ) 
 

frees memory


Member Function Documentation

CK_ATTRIBUTE * AttributeContainer::getAttribute CK_ATTRIBUTE_TYPE  type  ) 
 

Returns:
the attribute based on the type input. NULL if it doesn't exist

map< CK_ATTRIBUTE_TYPE, CK_ATTRIBUTE * > AttributeContainer::getAttributes  ) 
 

Returns:
std::map of type->attribute pairs for attribs in this container

CK_ATTRIBUTE * AttributeContainer::addAttribute CK_ATTRIBUTE_TYPE  type,
void *  value,
size_t  size
 

This method, along with all the others, creates a new ATTRIBUTE and populates the value and length from the parameters.

Parameters:
type the CRYPTOKI attribute type
value the value to be copied in
size the length of that value in memory so as to not be overwritten
Returns:
the new attribute created from the parameters

CK_ATTRIBUTE * AttributeContainer::addAttribute CK_ATTRIBUTE_TYPE  type,
X509_NAME *  name
 

This method, along with all the others, creates a new ATTRIBUTE and populates the value and length from the parameters.

Parameters:
type the CRYPTOKI attribute type
name the name struct that will be stored as the DER encoded value of this attrib
Returns:
the new attribute created from the parameters

CK_ATTRIBUTE * AttributeContainer::addAttribute CK_ATTRIBUTE_TYPE  type,
ASN1_STRING *  string
 

This method, along with all the others, creates a new ATTRIBUTE and populates the value and length from the parameters.

Parameters:
type the CRYPTOKI attribute type
string the ASN1 string that will be DER encoded. Many attributes from a X509 cert are ASN1 Strings
Returns:
the new attribute created from the parameters

CK_ATTRIBUTE * AttributeContainer::addAttribute CK_ATTRIBUTE_TYPE  type,
CK_DATE *  date,
ASN1_STRING *  str
 

This method, along with all the others, creates a new ATTRIBUTE and populates the value and length from the parameters. THIS method does not DER encoded the data into the attrib as other methods do. Cryptoki expects it to be in a special form from the ASN1_STRING value and converts it to the correctly formatted CRYPTOKI CK_DATE pointed to by 'date'.

Parameters:
type the CRYPTOKI attribute type
date the recipient struct for the date from the String 'str'
str the ASN1 encoded string that contains date information that will be cryptoki translated
Returns:
the new attribute created from the parameters

CK_ATTRIBUTE * AttributeContainer::addAttribute CK_ATTRIBUTE_TYPE  type,
BIGNUM *  num
 

This method, along with all the others, creates a new ATTRIBUTE and populates the value and length from the parameters.

Parameters:
type the CRYPTOKI attribute type
num the numeric value that will be stored as the value of this attrib.
Returns:
the new attribute created from the parameters

CK_ATTRIBUTE * AttributeContainer::addAttribute CK_ATTRIBUTE_TYPE  type,
X509 *  x509
 

This method, along with all the others, creates a new ATTRIBUTE and populates the value and length from the parameters.

Parameters:
type the CRYPTOKI attribute type
name the DER encoded contents of an entire X509 struct
Returns:
the new attribute created from the parameters

void AttributeContainer::clear  ) 
 

clears all attributes


Generated on Fri Jan 12 15:48:43 2007 for NIST_PKCS11 by doxygen 1.3.1 using KingsTools