using std::list;
using std::string;
using std::cout;
-using boost::shared_ptr;
+using std::ostream;
using namespace dcp;
/** @param c X509 certificate, which this object will take ownership of */
return _public_key;
}
+bool
+dcp::operator== (Certificate const & a, Certificate const & b)
+{
+ return a.certificate() == b.certificate();
+}
+
+bool
+dcp::operator< (Certificate const & a, Certificate const & b)
+{
+ return a.certificate() < b.certificate();
+}
+
+ostream&
+dcp::operator<< (ostream& s, Certificate const & c)
+{
+ s << c.certificate();
+ return s;
+}
+
/** @return Root certificate */
-shared_ptr<const Certificate>
+Certificate
CertificateChain::root () const
{
assert (!_certificates.empty());
}
/** @return Leaf certificate */
-shared_ptr<const Certificate>
+Certificate
CertificateChain::leaf () const
{
assert (_certificates.size() >= 2);
* @param c Certificate to add.
*/
void
-CertificateChain::add (shared_ptr<const Certificate> c)
+CertificateChain::add (Certificate c)
{
_certificates.push_back (c);
}
* @param c Certificate to remove.
*/
void
-CertificateChain::remove (shared_ptr<const Certificate> c)
+CertificateChain::remove (Certificate c)
{
_certificates.remove (c);
}
break;
}
- if (!X509_STORE_add_cert (store, (*i)->x509 ())) {
+ if (!X509_STORE_add_cert (store, i->x509 ())) {
X509_STORE_free (store);
return false;
}
}
X509_STORE_set_flags (store, 0);
- if (!X509_STORE_CTX_init (ctx, store, (*j)->x509 (), 0)) {
+ if (!X509_STORE_CTX_init (ctx, store, j->x509 (), 0)) {
X509_STORE_CTX_free (ctx);
X509_STORE_free (store);
return false;