mirror of
https://github.com/mtrojnar/osslsigncode.git
synced 2025-05-20 10:24:29 -05:00
disable verification of the Timestamp Server signature
This commit is contained in:
parent
8ba94fafd9
commit
1c523ed616
@ -238,7 +238,7 @@ typedef struct {
|
|||||||
#endif /* ENABLE_CURL */
|
#endif /* ENABLE_CURL */
|
||||||
int addBlob;
|
int addBlob;
|
||||||
int nest;
|
int nest;
|
||||||
int timestamp_expiration;
|
int ignore_timestamp;
|
||||||
int verbose;
|
int verbose;
|
||||||
int add_msi_dse;
|
int add_msi_dse;
|
||||||
char *catalog;
|
char *catalog;
|
||||||
@ -1227,9 +1227,9 @@ static void usage(const char *argv0, const char *cmd)
|
|||||||
printf("%12s[ -CRLfile <infile> ]\n", "");
|
printf("%12s[ -CRLfile <infile> ]\n", "");
|
||||||
printf("%12s[ -TSA-CAfile <infile> ]\n", "");
|
printf("%12s[ -TSA-CAfile <infile> ]\n", "");
|
||||||
printf("%12s[ -TSA-CRLfile <infile> ]\n", "");
|
printf("%12s[ -TSA-CRLfile <infile> ]\n", "");
|
||||||
|
printf("%12s[ -ignore_timestamp ]\n", "");
|
||||||
printf("%12s[ -time <unix-time> ]\n", "");
|
printf("%12s[ -time <unix-time> ]\n", "");
|
||||||
printf("%12s[ -require-leaf-hash {md5,sha1,sha2(56),sha384,sha512}:XXXXXXXXXXXX... ]\n", "");
|
printf("%12s[ -require-leaf-hash {md5,sha1,sha2(56),sha384,sha512}:XXXXXXXXXXXX... ]\n", "");
|
||||||
printf("%12s[ -timestamp-expiration ]\n", "");
|
|
||||||
printf("%12s[ -verbose ]\n\n", "");
|
printf("%12s[ -verbose ]\n\n", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1280,7 +1280,7 @@ static void help_for(const char *argv0, const char *cmd)
|
|||||||
const char *cmds_require_leaf_hash[] = {"attach-signature", "verify", NULL};
|
const char *cmds_require_leaf_hash[] = {"attach-signature", "verify", NULL};
|
||||||
const char *cmds_sigin[] = {"attach-signature", NULL};
|
const char *cmds_sigin[] = {"attach-signature", NULL};
|
||||||
const char *cmds_time[] = {"attach-signature", "sign", "verify", NULL};
|
const char *cmds_time[] = {"attach-signature", "sign", "verify", NULL};
|
||||||
const char *cmds_timestamp_expiration[] = {"verify", NULL};
|
const char *cmds_ignore_timestamp[] = {"verify", NULL};
|
||||||
#ifdef ENABLE_CURL
|
#ifdef ENABLE_CURL
|
||||||
const char *cmds_t[] = {"add", "sign", NULL};
|
const char *cmds_t[] = {"add", "sign", NULL};
|
||||||
const char *cmds_ts[] = {"add", "sign", NULL};
|
const char *cmds_ts[] = {"add", "sign", NULL};
|
||||||
@ -1412,8 +1412,8 @@ static void help_for(const char *argv0, const char *cmd)
|
|||||||
}
|
}
|
||||||
if (on_list(cmd, cmds_sigin))
|
if (on_list(cmd, cmds_sigin))
|
||||||
printf("%-24s= a file containing the signature to be attached\n", "-sigin");
|
printf("%-24s= a file containing the signature to be attached\n", "-sigin");
|
||||||
if (on_list(cmd, cmds_timestamp_expiration))
|
if (on_list(cmd, cmds_ignore_timestamp))
|
||||||
printf("%-24s= verify a finite lifetime of the TSA private key\n", "-timestamp-expiration");
|
printf("%-24s= disable verification of the Timestamp Server signature\n", "-ignore-timestamp");
|
||||||
#ifdef ENABLE_CURL
|
#ifdef ENABLE_CURL
|
||||||
if (on_list(cmd, cmds_t)) {
|
if (on_list(cmd, cmds_t)) {
|
||||||
printf("%-24s= specifies that the digital signature will be timestamped\n", "-t");
|
printf("%-24s= specifies that the digital signature will be timestamped\n", "-t");
|
||||||
@ -2719,22 +2719,14 @@ static int verify_timestamp(SIGNATURE *signature, GLOBAL_OPTIONS *options)
|
|||||||
if (!store)
|
if (!store)
|
||||||
goto out;
|
goto out;
|
||||||
if (load_file_lookup(store, options->tsa_cafile)) {
|
if (load_file_lookup(store, options->tsa_cafile)) {
|
||||||
/*
|
/* verify timestamp against the time of its creation */
|
||||||
* The TSA signing key MUST be of a sufficient length to allow for a sufficiently
|
if (!set_store_time(store, signature->time)) {
|
||||||
* long lifetime. Even if this is done, the key will have a finite lifetime.
|
printf("Failed to set store time\n");
|
||||||
* Thus, any token signed by the TSA SHOULD be time-stamped again or notarized
|
X509_STORE_free(store);
|
||||||
* at a later date to renew the trust that exists in the TSA's signature.
|
goto out;
|
||||||
* https://tools.ietf.org/html/rfc3161
|
}
|
||||||
*/
|
|
||||||
if (!options->timestamp_expiration)
|
|
||||||
/* verify timestamp against the time of its creation */
|
|
||||||
if (!set_store_time(store, signature->time)) {
|
|
||||||
printf("Failed to set store time\n");
|
|
||||||
X509_STORE_free(store);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
printf("Use the \"-TSA-CAfile\" option to add the Time-Stamp Authority certificates bundle to verify timestamp server.\n");
|
printf("Use the \"-TSA-CAfile\" option to add the Time-Stamp Authority certificates bundle to verify the Timestamp Server.\n");
|
||||||
X509_STORE_free(store);
|
X509_STORE_free(store);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -2807,15 +2799,7 @@ static int verify_authenticode(SIGNATURE *signature, GLOBAL_OPTIONS *options, X5
|
|||||||
X509_STORE_free(store);
|
X509_STORE_free(store);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (options->time != INVALID_TIME) {
|
if (signature->time != INVALID_TIME) {
|
||||||
printf("Signature verification time: ");
|
|
||||||
print_time_t(options->time);
|
|
||||||
if (!set_store_time(store, options->time)) {
|
|
||||||
printf("Failed to set verifying time\n");
|
|
||||||
X509_STORE_free(store);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
} else if (signature->time != INVALID_TIME) {
|
|
||||||
printf("Signature verification time: ");
|
printf("Signature verification time: ");
|
||||||
print_time_t(signature->time);
|
print_time_t(signature->time);
|
||||||
if (!set_store_time(store, signature->time)) {
|
if (!set_store_time(store, signature->time)) {
|
||||||
@ -2823,8 +2807,15 @@ static int verify_authenticode(SIGNATURE *signature, GLOBAL_OPTIONS *options, X5
|
|||||||
X509_STORE_free(store);
|
X509_STORE_free(store);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
} else if (options->time != INVALID_TIME) {
|
||||||
|
printf("Signature verification time: ");
|
||||||
|
print_time_t(options->time);
|
||||||
|
if (!set_store_time(store, options->time)) {
|
||||||
|
printf("Failed to set verifying time\n");
|
||||||
|
X509_STORE_free(store);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* verify a PKCS#7 signedData structure */
|
/* verify a PKCS#7 signedData structure */
|
||||||
if (signature->p7->d.sign->contents->d.other->type == V_ASN1_SEQUENCE) {
|
if (signature->p7->d.sign->contents->d.other->type == V_ASN1_SEQUENCE) {
|
||||||
/* only verify the contents of the sequence */
|
/* only verify the contents of the sequence */
|
||||||
@ -2908,9 +2899,14 @@ static int verify_signature(SIGNATURE *signature, GLOBAL_OPTIONS *options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (signature->timestamp) {
|
if (signature->timestamp) {
|
||||||
int timeok = verify_timestamp(signature, options);
|
if (!options->ignore_timestamp) {
|
||||||
printf("Timestamp Server Signature verification: %s\n", timeok ? "ok" : "failed");
|
int timeok = verify_timestamp(signature, options);
|
||||||
if (!timeok) {
|
printf("Timestamp Server Signature verification: %s\n", timeok ? "ok" : "failed");
|
||||||
|
if (!timeok) {
|
||||||
|
signature->time = INVALID_TIME;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf("\nTimestamp Server Signature verification is disabled\n\n");
|
||||||
signature->time = INVALID_TIME;
|
signature->time = INVALID_TIME;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@ -5797,8 +5793,8 @@ static int main_configure(int argc, char **argv, cmd_type_t *cmd, GLOBAL_OPTIONS
|
|||||||
options->addBlob = 1;
|
options->addBlob = 1;
|
||||||
} else if ((*cmd == CMD_SIGN || *cmd == CMD_ATTACH) && !strcmp(*argv, "-nest")) {
|
} else if ((*cmd == CMD_SIGN || *cmd == CMD_ATTACH) && !strcmp(*argv, "-nest")) {
|
||||||
options->nest = 1;
|
options->nest = 1;
|
||||||
} else if ((*cmd == CMD_VERIFY) && !strcmp(*argv, "-timestamp-expiration")) {
|
} else if ((*cmd == CMD_VERIFY) && !strcmp(*argv, "-ignore-timestamp")) {
|
||||||
options->timestamp_expiration = 1;
|
options->ignore_timestamp = 1;
|
||||||
} else if ((*cmd == CMD_SIGN || *cmd == CMD_ADD || *cmd == CMD_VERIFY) && !strcmp(*argv, "-verbose")) {
|
} else if ((*cmd == CMD_SIGN || *cmd == CMD_ADD || *cmd == CMD_VERIFY) && !strcmp(*argv, "-verbose")) {
|
||||||
options->verbose = 1;
|
options->verbose = 1;
|
||||||
} else if ((*cmd == CMD_SIGN || *cmd == CMD_ADD || *cmd == CMD_ATTACH) && !strcmp(*argv, "-add-msi-dse")) {
|
} else if ((*cmd == CMD_SIGN || *cmd == CMD_ADD || *cmd == CMD_ATTACH) && !strcmp(*argv, "-add-msi-dse")) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user