From 5e10a6f047d12f1e2e3d0e2f8ee30f93897a2227 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 17 Jan 2025 01:31:38 +0100 Subject: Allow KDMRecipient and hence Screen to convert certs to dcp::Certificate lazily. This is pretty slow (as it runs the certificate through OpenSSL) and we don't need to do it for every certificate in a database when we load the database. --- src/lib/kdm_recipient.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/lib/kdm_recipient.h') diff --git a/src/lib/kdm_recipient.h b/src/lib/kdm_recipient.h index f18e71429..9fe75874d 100644 --- a/src/lib/kdm_recipient.h +++ b/src/lib/kdm_recipient.h @@ -36,11 +36,18 @@ LIBDCP_ENABLE_WARNINGS class KDMRecipient { public: - KDMRecipient (std::string const& name_, std::string const& notes_, boost::optional recipient_, boost::optional recipient_file_) + KDMRecipient (std::string const& name_, std::string const& notes_, boost::optional recipient, boost::optional recipient_file_) : name (name_) , notes (notes_) - , recipient (recipient_) , recipient_file (recipient_file_) + , _recipient(recipient) + {} + + KDMRecipient(std::string const& name_, std::string const& notes_, boost::optional recipient, boost::optional recipient_file_) + : name(name_) + , notes(notes_) + , recipient_file(recipient_file_) + , _recipient_string(recipient) {} explicit KDMRecipient (cxml::ConstNodePtr); @@ -49,13 +56,22 @@ public: virtual void as_xml (xmlpp::Element *) const; + boost::optional recipient() const; + void set_recipient(boost::optional certificate); + std::string name; std::string notes; - boost::optional recipient; /** The pathname or URL that the recipient certificate was obtained from; purely * to inform the user. */ boost::optional recipient_file; + +private: + /* The recipient certificate may be stored as either a string or a dcp::Certificate; + * the string is useful if we want to be lazy about constructing the dcp::Certificate. + */ + boost::optional _recipient; + boost::optional _recipient_string; }; -- cgit v1.2.3