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
This commit is contained in:
nils 2005-01-13 21:52:39 +00:00
parent 5e552bddc1
commit d73ed35678
3 changed files with 11 additions and 6 deletions

View File

@ -61,7 +61,7 @@ option.
Before installing any user objects such as private keys, you need Before installing any user objects such as private keys, you need
at least one PIN to protect these objects. you can do this using at least one PIN to protect these objects. you can do this using
.PP .PP
.BI " pkcs15-init --store-pin --auth-id " nn .BI " pkcs15-init --store-pin --id " nn
.PP .PP
where \fInn\fP is a PKCS #15 ID in hexadecimal notation. Common values where \fInn\fP is a PKCS #15 ID in hexadecimal notation. Common values
are \fB01\fP, \fB02\fP, etc. are \fB01\fP, \fB02\fP, etc.

View File

@ -596,6 +596,7 @@ do_store_pin(struct sc_profile *profile)
sc_pkcs15_pin_info_t info; sc_pkcs15_pin_info_t info;
sc_ui_hints_t hints; sc_ui_hints_t hints;
int r; int r;
const char *pin_id;
memset(&hints, 0, sizeof(hints)); memset(&hints, 0, sizeof(hints));
hints.usage = SC_UI_USAGE_NEW_PIN; hints.usage = SC_UI_USAGE_NEW_PIN;
@ -606,8 +607,10 @@ do_store_pin(struct sc_profile *profile)
hints.p15card = p15card; hints.p15card = p15card;
hints.info.pin = &info; hints.info.pin = &info;
if (!opt_authid) { pin_id = opt_objectid ? opt_objectid : opt_authid;
error("No auth id specified\n");
if (!pin_id) {
error("No pin id specified\n");
return SC_ERROR_INVALID_ARGUMENTS; return SC_ERROR_INVALID_ARGUMENTS;
} }
@ -632,7 +635,7 @@ do_store_pin(struct sc_profile *profile)
} }
memset(&args, 0, sizeof(args)); 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 = (u8 *) opt_pins[0];
args.pin_len = strlen(opt_pins[0]); args.pin_len = strlen(opt_pins[0]);
args.puk = (u8 *) opt_pins[1]; args.puk = (u8 *) opt_pins[1];

View File

@ -625,6 +625,8 @@ void print_pin_info(const struct sc_pkcs15_object *obj)
"integrity-protected", "confidentiality-protected", "integrity-protected", "confidentiality-protected",
"exchangeRefData" "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 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]); const int pf_count = sizeof(pin_flags)/sizeof(pin_flags[0]);
char path[SC_MAX_PATH_SIZE * 2 + 1]; 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("PIN [%s]\n", obj->label);
printf("\tCom. Flags: 0x%X\n", obj->flags); 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); printf("\tFlags : [0x%02X]", pin->flags);
for (i = 0; i < pf_count; i++) for (i = 0; i < pf_count; i++)
if (pin->flags & (1 << 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); pin->min_length, pin->max_length, pin->stored_length);
printf("\tPad char : 0x%02X\n", pin->pad_char); printf("\tPad char : 0x%02X\n", pin->pad_char);
printf("\tReference : %d\n", pin->reference); 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); printf("\tPath : %s\n", path);
if (pin->tries_left >= 0) if (pin->tries_left >= 0)
printf("\tTries left: %d\n", pin->tries_left); printf("\tTries left: %d\n", pin->tries_left);