allow setting of verify names in command line utilities and print out verify names in verify utility
This commit is contained in:
parent
9b3d75706e
commit
04e4b82726
19
apps/apps.c
19
apps/apps.c
@ -2239,6 +2239,7 @@ int args_verify(char ***pargs, int *pargc,
|
|||||||
int purpose = 0, depth = -1;
|
int purpose = 0, depth = -1;
|
||||||
char **oldargs = *pargs;
|
char **oldargs = *pargs;
|
||||||
char *arg = **pargs, *argn = (*pargs)[1];
|
char *arg = **pargs, *argn = (*pargs)[1];
|
||||||
|
const X509_VERIFY_PARAM *vpm = NULL;
|
||||||
if (!strcmp(arg, "-policy"))
|
if (!strcmp(arg, "-policy"))
|
||||||
{
|
{
|
||||||
if (!argn)
|
if (!argn)
|
||||||
@ -2276,6 +2277,21 @@ int args_verify(char ***pargs, int *pargc,
|
|||||||
}
|
}
|
||||||
(*pargs)++;
|
(*pargs)++;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(arg,"-verify_name") == 0)
|
||||||
|
{
|
||||||
|
if (!argn)
|
||||||
|
*badarg = 1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vpm = X509_VERIFY_PARAM_lookup(argn);
|
||||||
|
if(!vpm)
|
||||||
|
{
|
||||||
|
BIO_printf(err, "unrecognized verify name\n");
|
||||||
|
*badarg = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(*pargs)++;
|
||||||
|
}
|
||||||
else if (strcmp(arg,"-verify_depth") == 0)
|
else if (strcmp(arg,"-verify_depth") == 0)
|
||||||
{
|
{
|
||||||
if (!argn)
|
if (!argn)
|
||||||
@ -2334,6 +2350,9 @@ int args_verify(char ***pargs, int *pargc,
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vpm)
|
||||||
|
X509_VERIFY_PARAM_set1(*pm, vpm);
|
||||||
|
|
||||||
if (otmp)
|
if (otmp)
|
||||||
X509_VERIFY_PARAM_add0_policy(*pm, otmp);
|
X509_VERIFY_PARAM_add0_policy(*pm, otmp);
|
||||||
if (flags)
|
if (flags)
|
||||||
|
@ -234,13 +234,26 @@ end:
|
|||||||
BIO_printf(bio_err," [-engine e]");
|
BIO_printf(bio_err," [-engine e]");
|
||||||
#endif
|
#endif
|
||||||
BIO_printf(bio_err," cert1 cert2 ...\n");
|
BIO_printf(bio_err," cert1 cert2 ...\n");
|
||||||
|
|
||||||
BIO_printf(bio_err,"recognized usages:\n");
|
BIO_printf(bio_err,"recognized usages:\n");
|
||||||
for(i = 0; i < X509_PURPOSE_get_count(); i++) {
|
for(i = 0; i < X509_PURPOSE_get_count(); i++)
|
||||||
|
{
|
||||||
X509_PURPOSE *ptmp;
|
X509_PURPOSE *ptmp;
|
||||||
ptmp = X509_PURPOSE_get0(i);
|
ptmp = X509_PURPOSE_get0(i);
|
||||||
BIO_printf(bio_err, "\t%-10s\t%s\n", X509_PURPOSE_get0_sname(ptmp),
|
BIO_printf(bio_err, "\t%-10s\t%s\n",
|
||||||
|
X509_PURPOSE_get0_sname(ptmp),
|
||||||
X509_PURPOSE_get0_name(ptmp));
|
X509_PURPOSE_get0_name(ptmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIO_printf(bio_err,"recognized verify names:\n");
|
||||||
|
for(i = 0; i < X509_VERIFY_PARAM_get_count(); i++)
|
||||||
|
{
|
||||||
|
const X509_VERIFY_PARAM *vptmp;
|
||||||
|
vptmp = X509_VERIFY_PARAM_get0(i);
|
||||||
|
BIO_printf(bio_err, "\t%-10s\n",
|
||||||
|
X509_VERIFY_PARAM_get0_name(vptmp));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (vpm) X509_VERIFY_PARAM_free(vpm);
|
if (vpm) X509_VERIFY_PARAM_free(vpm);
|
||||||
if (cert_ctx != NULL) X509_STORE_free(cert_ctx);
|
if (cert_ctx != NULL) X509_STORE_free(cert_ctx);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user