diff --git a/src/suisseid.hxx b/src/suisseid.hxx index c8b898c..a5c3960 100644 --- a/src/suisseid.hxx +++ b/src/suisseid.hxx @@ -145,7 +145,26 @@ namespace suisseid { /*! @addtogroup suisseidtypes */ //@{ /// DER encoded binary certificate - typedef std::string Certificate; + class Certificate: public std::string { + public: + Certificate(const std::string& v, + const std::string& l, + const cryptoki::Attribute& i): + std::string(v), + _label(l), + _id(i) { + } + const std::string& label() { + return _label; + } + const cryptoki::Attribute& id() { + return _id; + } + private: + std::string _label; + cryptoki::Attribute _id; + }; + /// List of DER encoded binary certificates typedef std::vector Certificates; //@} @@ -248,7 +267,9 @@ namespace suisseid { .from(CKO_CERTIFICATE))); for (cryptoki::ObjectList::iterator cert(certs.begin()); cert!=certs.end(); ++cert) - res.push_back(cert->attribute(CKA_VALUE).value); + res.push_back(Certificate(cert->attribute(CKA_VALUE).value, + cert->attribute(CKA_LABEL).value, + cert->attribute(CKA_ID))); return res; } @@ -268,7 +289,9 @@ namespace suisseid { <attribute(CKA_VALUE).value; + return Certificate(cert->attribute(CKA_VALUE).value, + cert->attribute(CKA_LABEL).value, + id); } } throw no_certfound(keylabel);