Differences From Artifact [dcf2fb997e]:
- File
test.c
— part of check-in
[a3d727289c]
at
2010-05-12 14:52:58
on branch trunk
— Added test driver (from libssh-agent-pkcs11-provider)
Added basic ASN.1 X.509 BER decoder (from libssh-agent-pkcs11-provider)
Work towards updating CACKey to talk to CAC using PC/SC (user: rkeene, size: 18673) [annotate] [blame] [check-ins using]
To Artifact [a3fe09560a]:
- File test.c — part of check-in [780bd59a25] at 2010-05-13 18:24:24 on branch trunk — Fixed issues with PIN handling (user: rkeene, size: 18805) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
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;
}
| > | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
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;
}
|
| ︙ | ︙ | |||
261 262 263 264 265 266 267 |
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) {
| > > > | | | > > > | | > | 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 |
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) {
|
| ︙ | ︙ |