pass label on creation

This commit is contained in:
Marc Wäckerlin
2009-09-22 11:21:22 +00:00
parent 6732fc693b
commit c197689ead
2 changed files with 9 additions and 6 deletions

View File

@@ -240,21 +240,24 @@ namespace cryptoki {
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
Object Session::create(const openssl::X509& cert) { Object Session::create(const std::string& label, const openssl::X509& cert) {
AttributeList attrs; AttributeList attrs;
attrs.push_back(Attribute(CKA_CLASS) attrs.push_back(Attribute(CKA_CLASS)
.from<CK_OBJECT_CLASS>(CKO_CERTIFICATE)); .from<CK_OBJECT_CLASS>(CKO_CERTIFICATE));
attrs.push_back(Attribute(CKA_CERTIFICATE_TYPE) attrs.push_back(Attribute(CKA_CERTIFICATE_TYPE)
.from<CK_CERTIFICATE_TYPE>(CKC_X_509)); .from<CK_CERTIFICATE_TYPE>(CKC_X_509));
attrs.push_back(Attribute(CKA_LABEL, label));
attrs.push_back(Attribute(CKA_SUBJECT, cert.subjectDER())); attrs.push_back(Attribute(CKA_SUBJECT, cert.subjectDER()));
attrs.push_back(Attribute(CKA_VALUE, cert.valueDER())); attrs.push_back(Attribute(CKA_VALUE, cert.valueDER()));
return create(attrs); return create(attrs);
} }
Object Session::create(const openssl::PrivateKey& key) { Object Session::create(const std::string& label,
const openssl::PrivateKey& key) {
AttributeList attrs; AttributeList attrs;
return create(attrs); return create(attrs);
} }
Object Session::create(const openssl::PKCS12& p12) { Object Session::create(const std::string& label,
const openssl::PKCS12& p12) {
AttributeList attrs; AttributeList attrs;
return create(attrs); return create(attrs);
} }

View File

@@ -866,11 +866,11 @@ namespace cryptoki {
ObjectList find(const AttributeList& attrs=AttributeList()); ObjectList find(const AttributeList& attrs=AttributeList());
//! Create a new Certificate Object. //! Create a new Certificate Object.
Object create(const openssl::X509& cert); Object create(const std::string& label, const openssl::X509& cert);
//! Create a new PrivateKey Object. //! Create a new PrivateKey Object.
Object create(const openssl::PrivateKey& key); Object create(const std::string& label, const openssl::PrivateKey& key);
//! Create a new Certificate and optional PrivateKey Object. //! Create a new Certificate and optional PrivateKey Object.
Object create(const openssl::PKCS12& p12); Object create(const std::string& label, const openssl::PKCS12& p12);
//@} //@}