summaryrefslogtreecommitdiff
path: root/src/encrypted_kdm.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-05-24 12:47:36 +0100
committerCarl Hetherington <cth@carlh.net>2017-05-24 12:47:36 +0100
commit98c2cae73faf52dc346758e893f7e38d2c349c03 (patch)
treef54f9d62ac94960586c1f6ff999838ec25f5a240 /src/encrypted_kdm.cc
parent14fe126396241dc1bde571bd57e76e82f8cf4240 (diff)
Better exception when loading a KDM fails.
Diffstat (limited to 'src/encrypted_kdm.cc')
-rw-r--r--src/encrypted_kdm.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/encrypted_kdm.cc b/src/encrypted_kdm.cc
index b6a992fb..054162cc 100644
--- a/src/encrypted_kdm.cc
+++ b/src/encrypted_kdm.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2017 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
@@ -34,6 +34,7 @@
#include "encrypted_kdm.h"
#include "util.h"
#include "certificate_chain.h"
+#include "exceptions.h"
#include <libcxml/cxml.h>
#include <libxml++/document.h>
#include <libxml++/nodes/element.h>
@@ -525,9 +526,13 @@ public:
EncryptedKDM::EncryptedKDM (string s)
{
- shared_ptr<cxml::Document> doc (new cxml::Document ("DCinemaSecurityMessage"));
- doc->read_string (s);
- _data = new data::EncryptedKDMData (doc);
+ try {
+ shared_ptr<cxml::Document> doc (new cxml::Document ("DCinemaSecurityMessage"));
+ doc->read_string (s);
+ _data = new data::EncryptedKDMData (doc);
+ } catch (xmlpp::parse_error& e) {
+ throw KDMFormatError (e.what ());
+ }
}
EncryptedKDM::EncryptedKDM (