Add crypto-select and crypto-available.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19141 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-11-27 10:40:06 +00:00
parent ca894d0b27
commit e0a99a740d
2 changed files with 54 additions and 0 deletions

View File

@@ -383,6 +383,16 @@ command = {
argument="bytes"
help = "Generates random bytes and prints them to standard output"
}
command = {
name = "crypto-available"
min_args="0"
help = "Print available CMS crypto types"
}
command = {
name = "crypto-select"
min_args="0"
help = "Print available CMS crypto types"
}
command = {
name = "help"
name = "?"

View File

@@ -990,6 +990,50 @@ random_data(void *opt, int argc, char **argv)
return 0;
}
int
crypto_available(void *opt, int argc, char **argv)
{
int ret;
size_t len, i;
AlgorithmIdentifier *val;
ret = hx509_crypto_available(context, HX509_SELECT_ALL,
NULL, &val, &len);
if (ret)
errx(1, "hx509_crypto_available");
for (i = 0; i < len; i++) {
char *s;
der_print_heim_oid (&val[i].algorithm, '.', &s);
printf("%s\n", s);
free(s);
}
hx509_crypto_free_algs(val, len);
return 0;
}
int
crypto_select(void *opt, int argc, char **argv)
{
int ret;
char *s;
AlgorithmIdentifier val;
ret = hx509_crypto_select(context, HX509_SELECT_DIGEST,
NULL, NULL, &val);
if (ret)
errx(1, "hx509_crypto_available");
der_print_heim_oid (&val.algorithm, '.', &s);
printf("%s\n", s);
free(s);
free_AlgorithmIdentifier(&val);
return 0;
}
int
help(void *opt, int argc, char **argv)
{