summaryrefslogtreecommitdiff
path: root/src/p11tool.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2015-03-31 08:29:33 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2015-03-31 08:49:51 +0200
commitca058c5bb73ceb053129b6353430fbb82c1bca84 (patch)
treeb051d61ef3460dfb5e009a5699107d2f5c48bdd4 /src/p11tool.c
parent0c24b0e2271fd51d3e38163870fd6e5bcedd8fa6 (diff)
downloadgnutls-ca058c5bb73ceb053129b6353430fbb82c1bca84.tar.gz
p11tool: allow setting the CKA_ID on object initialization/generation
Diffstat (limited to 'src/p11tool.c')
-rw-r--r--src/p11tool.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/p11tool.c b/src/p11tool.c
index a6464228a2..563fda34ea 100644
--- a/src/p11tool.c
+++ b/src/p11tool.c
@@ -116,7 +116,7 @@ static void cmd_parser(int argc, char **argv)
const char *url = NULL;
unsigned int detailed_url = 0, optct;
unsigned int bits = 0;
- const char *label = NULL, *sec_param = NULL;
+ const char *label = NULL, *sec_param = NULL, *id = NULL;
unsigned flags;
optct = optionProcess(&p11toolOptions, argc, argv);
@@ -218,6 +218,10 @@ static void cmd_parser(int argc, char **argv)
label = OPT_ARG(LABEL);
}
+ if (HAVE_OPT(ID)) {
+ id = OPT_ARG(ID);
+ }
+
if (HAVE_OPT(BITS)) {
bits = OPT_VALUE_BITS;
}
@@ -269,7 +273,7 @@ static void cmd_parser(int argc, char **argv)
} else if (HAVE_OPT(EXPORT_CHAIN)) {
pkcs11_export_chain(outfile, url, flags, &cinfo);
} else if (HAVE_OPT(WRITE)) {
- pkcs11_write(outfile, url, label,
+ pkcs11_write(outfile, url, label, id,
flags, &cinfo);
} else if (HAVE_OPT(INITIALIZE))
pkcs11_init(outfile, url, label, &cinfo);
@@ -279,19 +283,19 @@ static void cmd_parser(int argc, char **argv)
key_type = GNUTLS_PK_EC;
pkcs11_generate(outfile, url, key_type,
get_bits(key_type, bits, sec_param, 0),
- label, detailed_url,
+ label, id, detailed_url,
flags, &cinfo);
} else if (HAVE_OPT(GENERATE_RSA)) {
key_type = GNUTLS_PK_RSA;
pkcs11_generate(outfile, url, key_type,
get_bits(key_type, bits, sec_param, 0),
- label, detailed_url,
+ label, id, detailed_url,
flags, &cinfo);
} else if (HAVE_OPT(GENERATE_DSA)) {
key_type = GNUTLS_PK_DSA;
pkcs11_generate(outfile, url, key_type,
get_bits(key_type, bits, sec_param, 0),
- label, detailed_url,
+ label, id, detailed_url,
flags, &cinfo);
} else if (HAVE_OPT(EXPORT_PUBKEY)) {
pkcs11_export_pubkey(outfile, url, detailed_url, flags, &cinfo);