Overview
Comment: | Fixed issues with PIN handling |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | 780bd59a252078419f62109ee749437fd198b8a7 |
User & Date: | rkeene on 2010-05-13 18:24:24 |
Other Links: | manifest | tags |
Context
2010-05-13
| ||
18:26 | Corrected warning check-in: ebb5a279f5 user: rkeene tags: trunk | |
18:24 | Fixed issues with PIN handling check-in: 780bd59a25 user: rkeene tags: trunk | |
18:22 | Updated to use unified return codes check-in: 123c71d946 user: rkeene tags: trunk | |
Changes
Modified test.c from [dcf2fb997e] to [a3fe09560a].
106
107
108
109
110
111
112
113
114
115
116
117
118
119
...
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
|
CK_ULONG byte_idx;
CK_UTF8CHAR user_pin[1024], *pucValue;
CK_OBJECT_CLASS objectClass;
CK_BYTE signature[1024], encrypted_buf[16384], decrypted_buf[16384];
CK_ULONG signature_len, encrypted_buflen, decrypted_buflen;
CK_MECHANISM mechanism = {CKM_RSA_PKCS, NULL, 0};
CK_RV chk_rv;
int i;
privateKeyObjects = malloc(sizeof(*privateKeyObjects) * 1024);
privateKeyObjects_root = privateKeyObjects;
for (i = 0; i < 1024; i++) {
privateKeyObjects[i] = CK_INVALID_HANDLE;
}
................................................................................
printf("\n");
}
}
chk_rv = C_OpenSession(slots[0], CKF_SERIAL_SESSION, NULL, NULL, &hSession);
if (chk_rv == CKR_OK) {
if ((tokenInfo.flags & CKF_LOGIN_REQUIRED) == CKF_LOGIN_REQUIRED) {
printf("** ENTER PIN: ");
fflush(stdout);
fgets((char *) user_pin, sizeof(user_pin), stdin);
while (user_pin[strlen((char *) user_pin) - 1] < ' ') {
user_pin[strlen((char *) user_pin) - 1] = '\0';
}
chk_rv = C_Login(hSession, CKU_USER, user_pin, strlen((char *) user_pin));
} else {
chk_rv = C_Login(hSession, CKU_USER, NULL, 0);
}
if (chk_rv == CKR_OK) {
|
>
>
>
>
|
|
|
>
>
>
|
|
>
|
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
...
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
CK_ULONG byte_idx; CK_UTF8CHAR user_pin[1024], *pucValue; CK_OBJECT_CLASS objectClass; CK_BYTE signature[1024], encrypted_buf[16384], decrypted_buf[16384]; CK_ULONG signature_len, encrypted_buflen, decrypted_buflen; CK_MECHANISM mechanism = {CKM_RSA_PKCS, NULL, 0}; CK_RV chk_rv; char *fgets_ret; int i; privateKeyObjects = malloc(sizeof(*privateKeyObjects) * 1024); privateKeyObjects_root = privateKeyObjects; for (i = 0; i < 1024; i++) { privateKeyObjects[i] = CK_INVALID_HANDLE; } ................................................................................ printf("\n"); } } chk_rv = C_OpenSession(slots[0], CKF_SERIAL_SESSION, NULL, NULL, &hSession); if (chk_rv == CKR_OK) { if ((tokenInfo.flags & CKF_LOGIN_REQUIRED) == CKF_LOGIN_REQUIRED) { fgets_ret = NULL; while (fgets_ret == NULL) { printf("** ENTER PIN: "); fflush(stdout); fgets_ret = fgets((char *) user_pin, sizeof(user_pin), stdin); } if (strlen(user_pin) >= 1) { while (user_pin[strlen((char *) user_pin) - 1] < ' ') { user_pin[strlen((char *) user_pin) - 1] = '\0'; } } chk_rv = C_Login(hSession, CKU_USER, user_pin, strlen((char *) user_pin)); } else { chk_rv = C_Login(hSession, CKU_USER, NULL, 0); } if (chk_rv == CKR_OK) { |