10 static void usage(const char const *cmd)
13 "usage: %s [-o backend:name=value] ... \"challenge\"\n",
17 int main(int argc, char *argv[])
19 unsigned char chal[64];
21 unsigned char rbuf[20];
22 int rsize = sizeof(rbuf);
27 while ((c = getopt(argc, argv, "ho:")) != -1) switch (c) {
32 if (pcsc_option(optarg)) {
33 fprintf(stderr, "Option \"%s\" bad\n", optarg);
41 if (optind != (argc - 1)) {
46 csize = strlen(argv[optind]);
47 if (csize > sizeof(chal)) {
48 fprintf(stderr, "Challenge longer than %d, cannot do that\n",
53 printf("\nIf the key is set to \"Jefe\" like this:\n"
54 "$ ykpersonalize -2 -o chal-resp -o chal-hmac -o hmac-lt64 \\\n"
55 "\t-a 4a65666500000000000000000000000000000000\n"
56 "and the challenge is \"what do ya want for nothing?\"\n"
58 "\"ef fc df 6a e5 eb 2f a2 d2 74 16 d5 f1 84 df 9c 25 9a 7c 79\"\n");
60 memset(chal, 0x00, sizeof(chal));
61 memcpy(chal, argv[optind], csize);
63 memset(rbuf, 0xFE, sizeof(rbuf));
64 rc = pcsc_cr(chal, csize, rbuf, &rsize);
65 printf("rc=%ld (%s) rsize=%d:", rc, pcsc_errstr(rc), rsize);
66 for (i = 0; i < rsize; i++) printf(" %02x", rbuf[i]);