summaryrefslogtreecommitdiff
path: root/src/certificates.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-07-21 15:42:48 +0100
committerCarl Hetherington <cth@carlh.net>2014-07-21 15:42:48 +0100
commit55c649e790b73e3f8d493cd12c346e3bddcba25d (patch)
tree4f50d87782a4ec58219e5a2ef468075b5e4d36f7 /src/certificates.cc
parent19356a292ba53b6d40270b1e74af5dad2304dbd5 (diff)
Remove some shared_ptr-itis.
Diffstat (limited to 'src/certificates.cc')
-rw-r--r--src/certificates.cc33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/certificates.cc b/src/certificates.cc
index 085cea80..601662ea 100644
--- a/src/certificates.cc
+++ b/src/certificates.cc
@@ -38,7 +38,7 @@
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 */
@@ -276,8 +276,27 @@ Certificate::public_key () const
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());
@@ -285,7 +304,7 @@ CertificateChain::root () const
}
/** @return Leaf certificate */
-shared_ptr<const Certificate>
+Certificate
CertificateChain::leaf () const
{
assert (_certificates.size() >= 2);
@@ -312,7 +331,7 @@ CertificateChain::leaf_to_root () const
* @param c Certificate to add.
*/
void
-CertificateChain::add (shared_ptr<const Certificate> c)
+CertificateChain::add (Certificate c)
{
_certificates.push_back (c);
}
@@ -321,7 +340,7 @@ CertificateChain::add (shared_ptr<const Certificate> c)
* @param c Certificate to remove.
*/
void
-CertificateChain::remove (shared_ptr<const Certificate> c)
+CertificateChain::remove (Certificate c)
{
_certificates.remove (c);
}
@@ -363,7 +382,7 @@ CertificateChain::valid () const
break;
}
- if (!X509_STORE_add_cert (store, (*i)->x509 ())) {
+ if (!X509_STORE_add_cert (store, i->x509 ())) {
X509_STORE_free (store);
return false;
}
@@ -375,7 +394,7 @@ CertificateChain::valid () const
}
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;