attributes are on the way

This commit is contained in:
Marc Wäckerlin
2009-08-31 11:28:33 +00:00
parent b5643a87a2
commit 481ae4ed8d
2 changed files with 48 additions and 27 deletions

View File

@@ -63,26 +63,32 @@ namespace cryptoki {
typedef std::set<CK_MECHANISM_TYPE> MechanismList;
//! Map Attribute Class to type
/*! @todo to be completed ... */
template<CK_ATTRIBUTE_TYPE Attribute> class AttributeType {};
template<> class AttributeType<CKA_CLASS> {
public: typedef CK_OBJECT_CLASS Type;
};
/*
template<> class AttributeType<> {
public: typedef Type;
};
template<> class AttributeType<> {
public: typedef Type;
};
template<> class AttributeType<> {
public: typedef Type;
};
template<> class AttributeType<> {
public: typedef Type;
};*/
typedef std::vector<CK_ATTRIBUTE_TYPE> AttributeTypeList;
typedef std::vector<CK_ATTRIBUTE> AttributeList;
// //! Map Attribute Class to type
// /*! @todo to be completed ... */
// template<CK_ATTRIBUTE_TYPE Attribute> class AttributeType {};
// template<> class AttributeType<CKA_CLASS> {
// public: typedef CK_OBJECT_CLASS Type;
// public: typedef Type Param;
// };
// template<> class AttributeType<CKA_KEY_TYPE> {
// public: typedef CK_KEY_TYPE Type;
// public: typedef Type Param;
// };
// template<> class AttributeType<CKA_APPLICATION> {
// public: typedef CK_CHAR Type;
// public: typedef std::string Param;
// };
// template<> class AttributeType<CKA_VALUE> {
// public: typedef CKA_BYTE Type;
// public: typedef std::string Param;
// };
// template<> class AttributeType<> {
// public: typedef Type;
// public: typedef Type Param;
// };
template<std::string::size_type SIZE>
class FixString: public std::string {
@@ -1208,15 +1214,17 @@ namespace cryptoki {
}
@endcode */
/*! @todo Not implemented:
@code
bool getattributevalue() {
AttributeList getattributevalue(const AttributeTypeList& attributes) {
AttributeList res;
for (AttributeTypeList::const_iterator it(attributes.begin());
it!=attributes.end(); ++it)
res.push_back((CK_ATTRIBUTE){*it, 0, 0});
//! calls @c C_GetAttributeValue
return check(_session._slot._init->_fn->C_GetAttributeValue(_session, CK_OBJECT_HANDLE,
CK_ATTRIBUTE_PTR, CK_ULONG),
CRYPTOKI_FN_LOG("C_GetAttributeValue"));
// return check(_session._slot._init->_fn->C_GetAttributeValue(_session, _object,
// CK_ATTRIBUTE_PTR, CK_ULONG),
// CRYPTOKI_FN_LOG("C_GetAttributeValue"));
return res;
}
@endcode */
/*! @todo Not implemented:
@code