@@ -454,7 +454,7 @@ ToolConfig::ToolConfig(int argc, char *argv[])
454
454
else if (arg == " --sigpsssha512" ) { siguri = URI_SHA512; rsaPss = true ; }
455
455
else if (arg == " --rsapkcs15" ) rsaPss = false ;
456
456
else if (arg == " --rsapss" ) rsaPss = true ;
457
- else if (value v{arg, " --tsurl" }) tsurl = v;
457
+ else if (value v{arg, " --tsurl= " }) tsurl = v;
458
458
else if (value v{arg, " --tslurl=" }) tslurl = v;
459
459
else if (value v{arg, " --tslcert=" }) tslcerts = vector<X509Cert>{ X509Cert (v) };
460
460
else if (arg == " --TSLAllowExpired" ) expired = true ;
@@ -512,6 +512,12 @@ unique_ptr<Signer> ToolConfig::getSigner(bool getwebsigner) const
512
512
return signer;
513
513
}
514
514
515
+ /* *
516
+ * Validate signature.
517
+ *
518
+ * @param signature Signature to validated
519
+ * @return EXIT_FAILURE (1) - failure, EXIT_SUCCESS (0) - success
520
+ */
515
521
static int validateSignature (const Signature *s, ToolConfig::Warning warning = ToolConfig::WWarning)
516
522
{
517
523
int returnCode = EXIT_SUCCESS;
@@ -782,18 +788,7 @@ static int add(const ToolConfig &p, const char *program)
782
788
static int signContainer (Container *doc, const unique_ptr<Signer> &signer, bool dontValidate = false )
783
789
{
784
790
if (Signature *signature = doc->sign (signer.get ()))
785
- {
786
- if (dontValidate)
787
- return EXIT_SUCCESS;
788
- try {
789
- signature->validate ();
790
- cout << " Validation: " << ToolConfig::GREEN << " OK" << ToolConfig::RESET << endl;
791
- return EXIT_SUCCESS;
792
- } catch (const Exception &e) {
793
- cout << " Validation: " << ToolConfig::RED << " FAILED" << ToolConfig::RESET << endl;
794
- cout << " Exception:" << endl << e;
795
- }
796
- }
791
+ return dontValidate ? EXIT_SUCCESS : validateSignature (signature);
797
792
return EXIT_FAILURE;
798
793
}
799
794
0 commit comments