From d73ed3567879d0ab9ebdc1dc38c809d23ece595c Mon Sep 17 00:00:00 2001 From: nils Date: Thu, 13 Jan 2005 21:52:39 +0000 Subject: [PATCH] change auth_id -> id, show pin type, update pkcs15-init manpage git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2073 c6295689-39f2-0310-b995-f0e70906c6a9 --- docs/pkcs15-init.1 | 2 +- src/tools/pkcs15-init.c | 9 ++++++--- src/tools/pkcs15-tool.c | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/pkcs15-init.1 b/docs/pkcs15-init.1 index 43496bad..fb890dfc 100644 --- a/docs/pkcs15-init.1 +++ b/docs/pkcs15-init.1 @@ -61,7 +61,7 @@ option. Before installing any user objects such as private keys, you need at least one PIN to protect these objects. you can do this using .PP -.BI " pkcs15-init --store-pin --auth-id " nn +.BI " pkcs15-init --store-pin --id " nn .PP where \fInn\fP is a PKCS #15 ID in hexadecimal notation. Common values are \fB01\fP, \fB02\fP, etc. diff --git a/src/tools/pkcs15-init.c b/src/tools/pkcs15-init.c index cd70d755..dd29ba03 100644 --- a/src/tools/pkcs15-init.c +++ b/src/tools/pkcs15-init.c @@ -596,6 +596,7 @@ do_store_pin(struct sc_profile *profile) sc_pkcs15_pin_info_t info; sc_ui_hints_t hints; int r; + const char *pin_id; memset(&hints, 0, sizeof(hints)); hints.usage = SC_UI_USAGE_NEW_PIN; @@ -606,8 +607,10 @@ do_store_pin(struct sc_profile *profile) hints.p15card = p15card; hints.info.pin = &info; - if (!opt_authid) { - error("No auth id specified\n"); + pin_id = opt_objectid ? opt_objectid : opt_authid; + + if (!pin_id) { + error("No pin id specified\n"); return SC_ERROR_INVALID_ARGUMENTS; } @@ -632,7 +635,7 @@ do_store_pin(struct sc_profile *profile) } memset(&args, 0, sizeof(args)); - sc_pkcs15_format_id(opt_authid, &args.auth_id); + sc_pkcs15_format_id(pin_id, &args.auth_id); args.pin = (u8 *) opt_pins[0]; args.pin_len = strlen(opt_pins[0]); args.puk = (u8 *) opt_pins[1]; diff --git a/src/tools/pkcs15-tool.c b/src/tools/pkcs15-tool.c index f014c399..992a087e 100644 --- a/src/tools/pkcs15-tool.c +++ b/src/tools/pkcs15-tool.c @@ -625,6 +625,8 @@ void print_pin_info(const struct sc_pkcs15_object *obj) "integrity-protected", "confidentiality-protected", "exchangeRefData" }; + const char *pin_types[] = {"bcd", "ascii-numeric", "UTF-8", + "halfnibble bcd", "iso 9664-1"}; const struct sc_pkcs15_pin_info *pin = (const struct sc_pkcs15_pin_info *) obj->data; const int pf_count = sizeof(pin_flags)/sizeof(pin_flags[0]); char path[SC_MAX_PATH_SIZE * 2 + 1]; @@ -639,7 +641,7 @@ void print_pin_info(const struct sc_pkcs15_object *obj) } printf("PIN [%s]\n", obj->label); printf("\tCom. Flags: 0x%X\n", obj->flags); - printf("\tAuth ID : %s\n", sc_pkcs15_print_id(&pin->auth_id)); + printf("\tID : %s\n", sc_pkcs15_print_id(&pin->auth_id)); printf("\tFlags : [0x%02X]", pin->flags); for (i = 0; i < pf_count; i++) if (pin->flags & (1 << i)) { @@ -650,7 +652,7 @@ void print_pin_info(const struct sc_pkcs15_object *obj) pin->min_length, pin->max_length, pin->stored_length); printf("\tPad char : 0x%02X\n", pin->pad_char); printf("\tReference : %d\n", pin->reference); - printf("\tType : %d\n", pin->type); + printf("\tType : %s\n", pin_types[pin->type]); printf("\tPath : %s\n", path); if (pin->tries_left >= 0) printf("\tTries left: %d\n", pin->tries_left);