/* listobjs [-P] [-s slot] [-i $id | -l $label] [-p $pin] */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#ifndef OPENCRYPTOKI
#include <security/cryptoki.h>
#else
#include <opencryptoki/pkcs11.h>
#endif
int
{
int i = 0, id = 0;
int c, errflg = 0;
};
extern char *optarg;
extern int optopt;
switch (c) {
case 'P':
public = 1;
break;
case 's':
break;
case 'i':
id &= 0xffff;
break;
case 'l':
break;
case 'p':
break;
case ':':
errflg++;
break;
case '?':
default:
errflg++;
}
}
if (errflg) {
"usage: listobjs [-P] [-s slot] [-p pin] -i id | $label\n");
exit(1);
}
all = 1;
if (slot)
if (id) {
} else if (label) {
}
/* Initialize the CRYPTOKI library */
exit(1);
}
/* Open a session on the slot found */
error = 1;
goto exit_program;
}
/* Login to the Token (Keystore) */
if (!public) {
if (!pin)
#ifndef OPENCRYPTOKI
#else
#endif
error = 1;
goto exit_session;
}
}
error = 1;
goto exit_session;
}
ulObjectCount = 1;
while (ulObjectCount) {
error = 1;
goto exit_search;
}
for (i = 0; i < ulObjectCount; i++) {
};
int j, len;
"C_GetAttributeValue[%d]: rv = 0x%.8X\n", i, rv);
if (rv = CKR_BUFFER_TOO_SMALL)
error = 1;
continue;
}
printf("object[%d]: handle %u class %d label[%u] '%s' id[%u] ",
if (len == 2) {
} else {
if (len > 8)
len = 8;
for (j = 0; j < len; j++)
printf("...\n");
else
printf("\n");
}
}
}
error = 1;
}
(void) C_CloseSession(hSession);
(void) C_Finalize(NULL_PTR);
}