hxtool: Add OID symbol resolution
This commit is contained in:
@@ -32,6 +32,13 @@
|
|||||||
*/
|
*/
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
|
command = {
|
||||||
|
name = "list-oids"
|
||||||
|
help = "List known OIDs"
|
||||||
|
function = "hxtool_list_oids"
|
||||||
|
min_args="0"
|
||||||
|
max_args="0"
|
||||||
|
}
|
||||||
command = {
|
command = {
|
||||||
name = "cms-create-sd"
|
name = "cms-create-sd"
|
||||||
name = "cms-sign"
|
name = "cms-sign"
|
||||||
@@ -171,6 +178,11 @@ command = {
|
|||||||
type = "string"
|
type = "string"
|
||||||
help = "file containing content"
|
help = "file containing content"
|
||||||
}
|
}
|
||||||
|
option = {
|
||||||
|
long = "oid-sym"
|
||||||
|
type = "flag"
|
||||||
|
help = "show symbolic name for OID"
|
||||||
|
}
|
||||||
min_args="1"
|
min_args="1"
|
||||||
max_args="2"
|
max_args="2"
|
||||||
argument="in-file [out-file]"
|
argument="in-file [out-file]"
|
||||||
@@ -575,6 +587,11 @@ command = {
|
|||||||
type = "string"
|
type = "string"
|
||||||
help = "type of CMS algorithm"
|
help = "type of CMS algorithm"
|
||||||
}
|
}
|
||||||
|
option = {
|
||||||
|
long = "oid-syms"
|
||||||
|
type = "flag"
|
||||||
|
help = "show symbolic names for OIDs"
|
||||||
|
}
|
||||||
name = "crypto-available"
|
name = "crypto-available"
|
||||||
min_args="0"
|
min_args="0"
|
||||||
help = "Print available CMS crypto types"
|
help = "Print available CMS crypto types"
|
||||||
@@ -595,6 +612,11 @@ command = {
|
|||||||
type = "strings"
|
type = "strings"
|
||||||
help = "peer limiting cmstypes"
|
help = "peer limiting cmstypes"
|
||||||
}
|
}
|
||||||
|
option = {
|
||||||
|
long = "oid-sym"
|
||||||
|
type = "flag"
|
||||||
|
help = "show symbolic name for OID"
|
||||||
|
}
|
||||||
name = "crypto-select"
|
name = "crypto-select"
|
||||||
min_args="0"
|
min_args="0"
|
||||||
help = "Print selected CMS type"
|
help = "Print selected CMS type"
|
||||||
|
@@ -101,11 +101,19 @@ static void
|
|||||||
parse_oid(const char *str, const heim_oid *def, heim_oid *oid)
|
parse_oid(const char *str, const heim_oid *def, heim_oid *oid)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if (str)
|
|
||||||
ret = der_parse_heim_oid (str, " .", oid);
|
if (str) {
|
||||||
else
|
const heim_oid *found = NULL;
|
||||||
|
|
||||||
|
ret = der_find_heim_oid_by_name(str, &found);
|
||||||
|
if (ret == 0)
|
||||||
|
ret = der_copy_oid(found, oid);
|
||||||
|
else
|
||||||
|
ret = der_parse_heim_oid (str, " .", oid);
|
||||||
|
} else {
|
||||||
ret = der_copy_oid(def, oid);
|
ret = der_copy_oid(def, oid);
|
||||||
if (ret)
|
}
|
||||||
|
if (ret)
|
||||||
errx(1, "parse_oid failed for: %s", str ? str : "default oid");
|
errx(1, "parse_oid failed for: %s", str ? str : "default oid");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +304,10 @@ cms_verify_sd(struct cms_verify_sd_options *opt, int argc, char **argv)
|
|||||||
|
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
der_print_heim_oid(&type, '.', &str);
|
if (opt->oid_sym_flag)
|
||||||
|
der_print_heim_oid_sym(&type, '.', &str);
|
||||||
|
else
|
||||||
|
der_print_heim_oid(&type, '.', &str);
|
||||||
printf("type: %s\n", str);
|
printf("type: %s\n", str);
|
||||||
free(str);
|
free(str);
|
||||||
der_free_oid(&type);
|
der_free_oid(&type);
|
||||||
@@ -1530,7 +1541,10 @@ crypto_available(struct crypto_available_options *opt, int argc, char **argv)
|
|||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
char *s;
|
char *s;
|
||||||
der_print_heim_oid (&val[i].algorithm, '.', &s);
|
if (opt->oid_syms_flag)
|
||||||
|
der_print_heim_oid_sym(&val[i].algorithm, '.', &s);
|
||||||
|
else
|
||||||
|
der_print_heim_oid(&val[i].algorithm, '.', &s);
|
||||||
printf("%s\n", s);
|
printf("%s\n", s);
|
||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
@@ -1566,7 +1580,10 @@ crypto_select(struct crypto_select_options *opt, int argc, char **argv)
|
|||||||
if (ret)
|
if (ret)
|
||||||
errx(1, "hx509_crypto_available");
|
errx(1, "hx509_crypto_available");
|
||||||
|
|
||||||
der_print_heim_oid (&selected.algorithm, '.', &s);
|
if (opt->oid_sym_flag)
|
||||||
|
der_print_heim_oid_sym(&selected.algorithm, '.', &s);
|
||||||
|
else
|
||||||
|
der_print_heim_oid(&selected.algorithm, '.', &s);
|
||||||
printf("%s\n", s);
|
printf("%s\n", s);
|
||||||
free(s);
|
free(s);
|
||||||
free_AlgorithmIdentifier(&selected);
|
free_AlgorithmIdentifier(&selected);
|
||||||
@@ -2288,6 +2305,23 @@ crl_sign(struct crl_sign_options *opt, int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
hxtool_list_oids(void *opt, int argc, char **argv)
|
||||||
|
{
|
||||||
|
const heim_oid *oid;
|
||||||
|
int cursor = -1;
|
||||||
|
|
||||||
|
while (der_match_heim_oid_by_name("", &cursor, &oid) == 0) {
|
||||||
|
char *s = NULL;
|
||||||
|
|
||||||
|
if ((errno = der_print_heim_oid_sym(oid, '.', &s)) > 0)
|
||||||
|
err(1, "der_print_heim_oid_sym");
|
||||||
|
printf("%s\n", s);
|
||||||
|
free(s);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user