common.h

00001 #ifndef COMMON_H
00002 #define COMMON_H
00003 
00004 #include "cryptoki.h"
00005 #include "piv.h"
00006 #include <winscard.h>
00007 #include <stdlib.h>
00008 #include <stdio.h>
00009 #include <memory.h>
00010 #include <map>
00011 #include <list>
00012 #include <vector>
00013 #include <string>
00014 using namespace std;
00015 
00016 #define CRIPTOKI_VERSION_MAJOR 2
00017 #define CRIPTOKI_VERSION_MINOR 0
00018 const char MANUFACTURER_ID[] = "Electrosoft Inc.";
00019 
00020 
00021 const char LIBRARY_DESCRIPTION[] = "Cryptoki module for PIV for NIST";
00022 #define LIBRARY_VERSION_MAJOR 1
00023 #define LIBRARY_VERSION_MINOR 0
00024 
00025 
00026 #define HARDWARE_VERSION_MAJOR 2
00027 #define HARDWARE_VERSION_MINOR 0
00028 #define FIRMWARE_VERSION_MAJOR 2
00029 #define FIRMWARE_VERSION_MINOR 0
00030 
00031 typedef struct {
00032     PIV_Byte tag; 
00033     PIV_Byte lofl; // length of length -> 0x80 + numbytes
00034     PIV_Byte length; 
00035 } TLV;
00036 
00037 typedef struct {
00038     PIV_Byte tag; 
00039     PIV_Byte lofl; // length of length -> 0x80 + numbytes
00040 } TL;
00041 typedef union {  
00042   // incase no padding, or alternate is needed
00043   PIV_Byte unformatted[128];
00044     
00045     struct {
00046       PIV_Byte rsaZero;
00047       PIV_Byte rsaOne;
00048       PIV_Byte data_ff_0_myData[126];// must be 0xff pre-padded and 0 termined as.. ff ff ff .. data\0
00049     } pkcs1_5;
00050     
00051 } CRYPTO_DATA;
00052 
00053 typedef union {
00054   PIV_Byte buffer[136]; //end apdu header
00055   struct {
00056     struct {
00057         TLV dynamic;
00058         TLV meta_data;
00059       } apdu;
00060     
00061     CRYPTO_DATA data;
00062     TL tl;
00063   } parts;
00064   
00065 } PIV_RSA_1024_CMD;
00066 
00067 #endif

Generated on Fri Jan 12 15:48:41 2007 for NIST_PKCS11 by doxygen 1.3.1 using KingsTools