hxtool: add generate-key command

This will help us not commit private keys in-tree for testing as we can now
more easily generate them as needed.
This commit is contained in:
Nicolas Williams
2019-07-01 22:46:12 -05:00
parent 049d817c66
commit cc8a5c59a8
2 changed files with 34 additions and 0 deletions

View File

@@ -1316,6 +1316,18 @@ get_key(const char *fn, const char *type, int optbits,
}
}
int
generate_key(struct generate_key_options *opt, int argc, char **argv)
{
hx509_private_key signer;
const char *type = opt->type_string ? opt->type_string : "rsa";
int bits = opt->key_bits_integer ? opt->key_bits_integer : 2048;
get_key(argv[0], type, bits, &signer);
hx509_private_key_free(&signer);
return 0;
}
int
request_create(struct request_create_options *opt, int argc, char **argv)
{