Skip to content

Commit

Permalink
pkcs11-tool added documentation about --key-type
Browse files Browse the repository at this point in the history
fixes #1928
  • Loading branch information
frankmorgner committed Jan 30, 2024
1 parent 48b4eb5 commit 49c320d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/tools/pkcs11-tool.1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
</term>
<listitem><para>Specify the type and length (bytes if symmetric) of the key to create,
for example RSA:1024, EC:prime256v1, GOSTR3410-2012-256:B,
DES:8, DES3:24, AES:16 or GENERIC:64.</para></listitem>
DES:8, DES3:24, AES:16 or GENERIC:64. If the key type was incompletely specified, possible values are listed.</para></listitem>
</varlistentry>

<varlistentry>
Expand Down
9 changes: 7 additions & 2 deletions src/tools/pkcs11-tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2918,8 +2918,13 @@ static int gen_keypair(CK_SLOT_ID slot, CK_SESSION_HANDLE session,
if (!strcmp(ec_curve_infos[ii].oid, type + 3))
break;
}
if (!ec_curve_infos[ii].name)
util_fatal("Unknown EC key params '%s'", type + 3);
if (!ec_curve_infos[ii].name) {
fprintf(stderr, "EC key parameters may be specified by their canonic name or object identifier. Possible values are:\n");
for (ii=0; ec_curve_infos[ii].name; ii++) {
fprintf(stderr, "%s (%s)\n", ec_curve_infos[ii].name, ec_curve_infos[ii].oid);
}
util_fatal("Unknown EC key parameter '%s'", type + 3);
}

switch (ec_curve_infos[ii].mechanism) {
case CKM_EC_EDWARDS_KEY_PAIR_GEN:
Expand Down

0 comments on commit 49c320d

Please sign in to comment.