Warn if the signing certificates have a validity period > 10 years (#2174).
authorCarl Hetherington <cth@carlh.net>
Sat, 12 Feb 2022 22:11:44 +0000 (23:11 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 12 Feb 2022 22:11:44 +0000 (23:11 +0100)
src/lib/config.cc
src/lib/config.h
src/tools/dcpomatic.cc

index cd0fce6a4a49f4f3c1040c6254abb098f51f41f3..913edcf183f52f11e5a6d7e584f3185f6b5bec63 100644 (file)
@@ -465,6 +465,9 @@ try
                if (i.has_utf8_strings()) {
                        bad = BAD_SIGNER_UTF8_STRINGS;
                }
+               if ((i.not_after().year() - i.not_before().year()) > 15) {
+                       bad = BAD_SIGNER_VALIDITY_TOO_LONG;
+               }
        }
 
        if (!_signer_chain->chain_valid() || !_signer_chain->private_key_valid()) {
@@ -481,6 +484,7 @@ try
                        switch (*bad) {
                        case BAD_SIGNER_UTF8_STRINGS:
                        case BAD_SIGNER_INCONSISTENT:
+                       case BAD_SIGNER_VALIDITY_TOO_LONG:
                                _signer_chain = create_certificate_chain ();
                                break;
                        case BAD_DECRYPTION_INCONSISTENT:
index 8532bb9d173833e942c52ecba11f776141189aa4..9dc123426cdef50fd27e6493c86c578600796234 100644 (file)
@@ -411,6 +411,7 @@ public:
                NAG_DELETE_DKDM,
                NAG_32_ON_64,
                NAG_TOO_MANY_DROPPED_FRAMES,
+               NAG_BAD_SIGNER_CHAIN_VALIDITY,
                NAG_COUNT
        };
 
@@ -1088,9 +1089,10 @@ public:
         *  true to ask Config to solve the problem (by discarding and recreating the bad thing)
         */
        enum BadReason {
-               BAD_SIGNER_UTF8_STRINGS,     ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
-               BAD_SIGNER_INCONSISTENT,     ///< signer chain is somehow inconsistent
-               BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
+               BAD_SIGNER_UTF8_STRINGS,      ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
+               BAD_SIGNER_INCONSISTENT,      ///< signer chain is somehow inconsistent
+               BAD_DECRYPTION_INCONSISTENT,  ///< KDM decryption chain is somehow inconsistent
+               BAD_SIGNER_VALIDITY_TOO_LONG, ///< signer certificate validity periods are >10 years
        };
 
        static boost::signals2::signal<bool (BadReason)> Bad;
index c133f4a7658d98d19c038955d2be310d6d70620a..6ff2d793f1a97b5370ad790fa341f485f307ee17 100644 (file)
@@ -1847,6 +1847,23 @@ private:
                        d->Destroy ();
                        return r == wxID_OK;
                }
+               case Config::BAD_SIGNER_VALIDITY_TOO_LONG:
+               {
+                       if (config->nagged(Config::NAG_BAD_SIGNER_CHAIN_VALIDITY)) {
+                               return false;
+                       }
+                       auto d = new RecreateChainDialog (
+                               _frame, _("Recreate signing certificates"),
+                               _("The certificate chain that DCP-o-matic uses for signing DCPs and KDMs has a validity period\n"
+                                 "that is too long.  This will cause problems playing back DCPs on some systems.\n"
+                                 "Do you want to re-create the certificate chain for signing DCPs and KDMs?"),
+                               _("Do nothing"),
+                               Config::NAG_BAD_SIGNER_CHAIN_VALIDITY
+                               );
+                       int const r = d->ShowModal ();
+                       d->Destroy ();
+                       return r == wxID_OK;
+               }
                case Config::BAD_SIGNER_INCONSISTENT:
                {
                        auto d = new RecreateChainDialog (