diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-01-17 01:31:38 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-01-22 14:34:25 +0100 |
| commit | 5e10a6f047d12f1e2e3d0e2f8ee30f93897a2227 (patch) | |
| tree | c3daccbbf2291d6330df2c2f6d99bf34fcb2e288 /src/lib/kdm_recipient.h | |
| parent | c29ba2526337b486d4a3b1a1468513a22293bc87 (diff) | |
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.
Diffstat (limited to 'src/lib/kdm_recipient.h')
| -rw-r--r-- | src/lib/kdm_recipient.h | 22 |
1 files changed, 19 insertions, 3 deletions
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<dcp::Certificate> recipient_, boost::optional<std::string> recipient_file_) + KDMRecipient (std::string const& name_, std::string const& notes_, boost::optional<dcp::Certificate> recipient, boost::optional<std::string> 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<std::string> recipient, boost::optional<std::string> 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<dcp::Certificate> recipient() const; + void set_recipient(boost::optional<dcp::Certificate> certificate); + std::string name; std::string notes; - boost::optional<dcp::Certificate> recipient; /** The pathname or URL that the recipient certificate was obtained from; purely * to inform the user. */ boost::optional<std::string> 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<dcp::Certificate> _recipient; + boost::optional<std::string> _recipient_string; }; |
