pass label on creation
This commit is contained in:
@@ -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;
|
||||
attrs.push_back(Attribute(CKA_CLASS)
|
||||
.from<CK_OBJECT_CLASS>(CKO_CERTIFICATE));
|
||||
attrs.push_back(Attribute(CKA_CERTIFICATE_TYPE)
|
||||
.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_VALUE, cert.valueDER()));
|
||||
return create(attrs);
|
||||
}
|
||||
Object Session::create(const openssl::PrivateKey& key) {
|
||||
Object Session::create(const std::string& label,
|
||||
const openssl::PrivateKey& key) {
|
||||
AttributeList attrs;
|
||||
return create(attrs);
|
||||
}
|
||||
Object Session::create(const openssl::PKCS12& p12) {
|
||||
Object Session::create(const std::string& label,
|
||||
const openssl::PKCS12& p12) {
|
||||
AttributeList attrs;
|
||||
return create(attrs);
|
||||
}
|
||||
|
@@ -866,11 +866,11 @@ namespace cryptoki {
|
||||
ObjectList find(const AttributeList& attrs=AttributeList());
|
||||
|
||||
//! 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.
|
||||
Object create(const openssl::PrivateKey& key);
|
||||
Object create(const std::string& label, const openssl::PrivateKey& key);
|
||||
//! Create a new Certificate and optional PrivateKey Object.
|
||||
Object create(const openssl::PKCS12& p12);
|
||||
Object create(const std::string& label, const openssl::PKCS12& p12);
|
||||
|
||||
//@}
|
||||
|
||||
|
Reference in New Issue
Block a user