pkcs11-tool: print the token before asking for a PIN code; shorten CKU_CONTEXT_SPECIFIC prompt

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4751 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
martin 2010-09-21 16:11:49 +00:00
parent 01931d6794
commit 3202355fa3
1 changed files with 4 additions and 3 deletions

View File

@ -554,7 +554,7 @@ int main(int argc, char * argv[])
opt_slot = p11_slots[opt_slot_index];
fprintf(stderr, "Using slot with index %lu (0x%lx)\n", opt_slot_index, opt_slot);
} else {
fprintf(stderr, "Slot with index %lu (counting from 0) is not available.\n");
fprintf(stderr, "Slot with index %lu (counting from 0) is not available.\n", opt_slot_index);
fprintf(stderr, "You must specify a valid slot with either --slot, --slot-index or --slot-label.\n");
err = 1;
goto end;
@ -888,13 +888,14 @@ static int login(CK_SESSION_HANDLE session, int login_type)
pin = opt_pin ? opt_pin : opt_puk;
if (!pin && (info.flags & CKF_LOGIN_REQUIRED)
&& !(info.flags & CKF_PROTECTED_AUTHENTICATION_PATH)) {
&& !(info.flags & CKF_PROTECTED_AUTHENTICATION_PATH)) {
printf("Logging in to \"%s\".\n", p11_utf8_to_local(info.label, sizeof(info.label)));
if (login_type == CKU_SO)
printf("Please enter SO PIN: ");
else if (login_type == CKU_USER)
printf("Please enter User PIN: ");
else if (login_type == CKU_CONTEXT_SPECIFIC)
printf("Please enter Specific Context Secret Code: ");
printf("Please enter context specific PIN: ");
r = util_getpass(&pin, &len, stdin);
if (r < 0)
util_fatal("No PIN entered, exiting!\n");