/* readkey [-s $slot] -l $label [-p $pin] -f $filename */
#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
{
char *label;
char *filename;
int error = 0;
int i = 0;
int c, errflg = 0;
};
};
extern char *optarg;
extern int optopt;
switch (c) {
case 's':
break;
case 'l':
break;
case 'p':
break;
case ':':
errflg++;
break;
case 'f':
break;
case '?':
default:
errflg++;
}
}
"usage: readkey [-s slot] -l label [-p pin] -f filename\n");
exit(1);
}
if (slot)
/* Initialize OpenSSL library */
if (!rsa) {
exit(1);
}
/* 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;
}
/* Set search template. */
error = 1;
goto exit_session;
}
error = 1;
goto exit_search;
}
if (ulObjectCount == 0) {
error = 1;
goto exit_search;
}
error = 1;
goto exit_search;
}
for (i = 0; i < attr_template[0].ulValueLen; i++)
printf("\n");
error = 1;
goto exit_search;
}
if (ulObjectCount != 0) {
error = 1;
goto exit_search;
}
printf("RSA=");
printf("Error opening output file.\n");
error = 1;
goto exit_search;
}
printf("Error writing output file.\n");
error = 1;
goto exit_search;
}
error = 1;
}
(void) C_CloseSession(hSession);
(void) C_Finalize(NULL_PTR);
}