Add method to return a base-64 version of a whole CertificateChain.
authorCarl Hetherington <cth@carlh.net>
Thu, 4 Aug 2016 21:33:03 +0000 (22:33 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 4 Aug 2016 21:33:03 +0000 (22:33 +0100)
src/certificate_chain.cc
src/certificate_chain.h

index 2ba701838723e41b29de4e59347d08b66e8588cf..0cf9ee06f676c856cc4eb660d65e059859ed4cb0 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
@@ -562,3 +562,14 @@ CertificateChain::add_signature_value (xmlpp::Node* parent, string ns) const
 
        xmlSecDSigCtxDestroy (signature_context);
 }
+
+string
+CertificateChain::chain () const
+{
+       string o;
+       BOOST_FOREACH (Certificate const &i, root_to_leaf ()) {
+               o += i.certificate(true);
+       }
+
+       return o;
+}
index 3a925373365509fbdb59030fa8d90b9a6bde8d58..ca259c088e0e5d5b6c532a971f4d78acf9916ee8 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
@@ -100,6 +100,8 @@ public:
                _key = k;
        }
 
+       std::string chain () const;
+
 private:
        friend class ::certificates;