From c197689eadaef090602fc349e6ffa1856637847b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Tue, 22 Sep 2009 11:21:22 +0000 Subject: [PATCH] pass label on creation --- src/cryptoki.cxx | 9 ++++++--- src/cryptoki.hxx | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/cryptoki.cxx b/src/cryptoki.cxx index e518146..d182af0 100644 --- a/src/cryptoki.cxx +++ b/src/cryptoki.cxx @@ -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(CKO_CERTIFICATE)); attrs.push_back(Attribute(CKA_CERTIFICATE_TYPE) .from(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); } diff --git a/src/cryptoki.hxx b/src/cryptoki.hxx index 3e5ce69..a645c2d 100644 --- a/src/cryptoki.hxx +++ b/src/cryptoki.hxx @@ -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); //@}