AttributeContainer.h

00001 #ifndef ATTRIBUTE_CONTAINER_H
00002 #define ATTRIBUTE_CONTAINER_H
00003 
00004 #include "common.h"
00005 #include <openssl/x509.h>
00006 
00013 typedef struct {
00014 
00015   CK_ATTRIBUTE contents;
00016   bool mustFree;
00017   
00018 } FLAGED_ATTRIB;
00019 
00025 class AttributeContainer
00026 {
00027   public:
00031     AttributeContainer(void);
00035     ~AttributeContainer(void);
00036     
00040     CK_ATTRIBUTE* getAttribute(CK_ATTRIBUTE_TYPE type);
00041     
00045     map<CK_ATTRIBUTE_TYPE,CK_ATTRIBUTE*> getAttributes();
00046     
00047     // overload is our friend. By overloading all of these different types we can allow the compiler
00048     // to figure out which method to call of a given type
00057     CK_ATTRIBUTE* addAttribute(CK_ATTRIBUTE_TYPE type, void* value,size_t size);    
00065     CK_ATTRIBUTE* addAttribute(CK_ATTRIBUTE_TYPE type,X509_NAME* name);
00073     CK_ATTRIBUTE* addAttribute(CK_ATTRIBUTE_TYPE type,ASN1_STRING* string);
00084     CK_ATTRIBUTE* addAttribute(CK_ATTRIBUTE_TYPE type,CK_DATE* date,ASN1_STRING* str);
00092     CK_ATTRIBUTE* addAttribute(CK_ATTRIBUTE_TYPE type,BIGNUM* num);
00100     CK_ATTRIBUTE* addAttribute(CK_ATTRIBUTE_TYPE type,X509* x509);
00104     void clear();
00105     
00106   private:
00110     map<CK_ATTRIBUTE_TYPE,FLAGED_ATTRIB*> attributes;
00111     CK_ATTRIBUTE* addAttribute(FLAGED_ATTRIB* attrib);
00112     CK_ATTRIBUTE* addAttribute(CK_ATTRIBUTE_TYPE type,void* value,size_t size,bool mustFree);
00113 };
00114 #endif

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