From 4e2d5cca82d19246bd1ebf24bc9e2bf436232f83 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 4 Aug 2016 22:33:03 +0100 Subject: Add method to return a base-64 version of a whole CertificateChain. --- src/certificate_chain.cc | 13 ++++++++++++- src/certificate_chain.h | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/certificate_chain.cc b/src/certificate_chain.cc index 2ba70183..0cf9ee06 100644 --- a/src/certificate_chain.cc +++ b/src/certificate_chain.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2015 Carl Hetherington + Copyright (C) 2013-2016 Carl Hetherington 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; +} diff --git a/src/certificate_chain.h b/src/certificate_chain.h index 3a925373..ca259c08 100644 --- a/src/certificate_chain.h +++ b/src/certificate_chain.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2015 Carl Hetherington + Copyright (C) 2013-2016 Carl Hetherington This file is part of libdcp. @@ -100,6 +100,8 @@ public: _key = k; } + std::string chain () const; + private: friend class ::certificates; -- cgit v1.2.3