/* destroyobj [-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 error = 0;
int id = 0, i = 0;
int c, errflg = 0;
};
extern char *optarg;
extern int optopt;
switch (c) {
case 's':
break;
case 'i':
id &= 0xffff;
break;
case 'l':
break;
case 'p':
break;
case ':':
errflg++;
break;
case '?':
default:
errflg++;
}
}
"usage: destroykey [-s slot] [-i id | -l label] [-p pin]\n");
exit(1);
}
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 (!pin)
#ifndef OPENCRYPTOKI
#else
#endif
error = 1;
goto exit_session;
}
error = 1;
goto exit_session;
}
error = 1;
goto exit_search;
}
for (i = 0; i < ulObjectCount; i++) {
};
int j, len;
error = 1;
goto exit_search;
}
printf("object[%d]: class %d label '%s' id[%u] ",
if (len > 4)
len = 4;
for (j = 0; j < len; j++)
printf("...\n");
else
printf("\n");
}
/* give a chance to kill this */
printf("sleeping 5 seconds...\n");
sleep(5);
for (i = 0; i < ulObjectCount; i++) {
error = 1;
}
}
error = 1;
}
(void) C_CloseSession(hSession);
(void) C_Finalize(NULL_PTR);
}