summaryrefslogtreecommitdiff
path: root/src/dcp.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-01-01 20:11:25 +0000
committerCarl Hetherington <cth@carlh.net>2013-01-01 20:11:25 +0000
commit3adf49eea65c2c015ae0b5bc7f066a599faf3933 (patch)
tree93e571aea5eec12772cf39058b51ddcabd8f3ee9 /src/dcp.cc
parent4f902db0ad994910a34ca845225635ceefcac96e (diff)
Some work on encryption / signing.
Diffstat (limited to 'src/dcp.cc')
-rw-r--r--src/dcp.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/dcp.cc b/src/dcp.cc
index 5db29beb..4b5e6789 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -51,6 +51,7 @@ using namespace libdcp;
DCP::DCP (string directory)
: _directory (directory)
+ , _encrypted (false)
{
boost::filesystem::create_directories (directory);
}
@@ -59,7 +60,7 @@ void
DCP::write_xml () const
{
for (list<shared_ptr<const CPL> >::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) {
- (*i)->write_xml ();
+ (*i)->write_xml (_encrypted, _certificates);
}
string pkl_uuid = make_uuid ();
@@ -423,7 +424,7 @@ CPL::add_reel (shared_ptr<const Reel> reel)
}
void
-CPL::write_xml () const
+CPL::write_xml (bool encrypted, CertificateChain const & certificates) const
{
boost::filesystem::path p;
p /= _directory;
@@ -453,8 +454,19 @@ CPL::write_xml () const
os << " </AssetList>\n"
<< " </Reel>\n"
- << " </ReelList>\n"
- << "</CompositionPlaylist>\n";
+ << " </ReelList>\n";
+
+ if (encrypted) {
+ os << " <dsig:X509Data>\n"
+ << " <dsig:X509IssuerSerial>\n"
+ << " <dsig:X509IssuerName>" << Certificate::name_for_xml (certificates.leaf()->issuer()) << "</dsig:IssuerName>\n"
+ << " <dsig:X509SerialNumber>" << certificates.leaf()->serial() << "</dsig:X509SerialNumber>\n"
+ << " <dsig:X509IssuerSerial>\n"
+ << " <dsig:X509SubjectName>" << Certificate::name_for_xml (certificates.leaf()->subject()) << "</dsig:X509SubjectName>\n"
+ << " </dsig:X509Data>\n";
+ }
+
+ os << "</CompositionPlaylist>\n";
os.close ();