PKIFERSTester.cpp

Go to the documentation of this file.
00001 // PKIFERSTester.cpp : Defines the entry point for the console application.
00002 //
00003 #include <tchar.h>
00004 #include "pkif.h"
00005 #include "EvidenceRecord.h"
00006 #include "ContentInfo.h"
00007 #include "SignedData.h"
00008 #include "EncapsulatedContentInfo.h"
00009 #include "TSTInfo.h"
00010 #include "SecuritySuitabilityPolicy.h"
00011 
00012 int dataLen = 1208;
00013 unsigned char data[] = {
00014 0x30,0x82,0x04,0xB4,0x02,0x01,0x00,0x30,0x0B,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,
00015 0x02,0x1A,0x05,0x00,0x30,0x82,0x04,0xA0,0x30,0x82,0x04,0x9C,0x30,0x82,0x04,0x98,
00016 0x30,0x82,0x04,0x94,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07,0x02,0xA0,
00017 0x82,0x04,0x85,0x30,0x82,0x04,0x81,0x02,0x01,0x03,0x31,0x0B,0x30,0x09,0x06,0x05,
00018 0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x30,0x69,0x06,0x0B,0x2A,0x86,0x48,0x86,0xF7,
00019 0x0D,0x01,0x09,0x10,0x01,0x04,0xA0,0x5A,0x04,0x58,0x30,0x56,0x02,0x01,0x01,0x06,
00020 0x09,0x2A,0x86,0x48,0x86,0xF6,0x7D,0x07,0x4B,0x00,0x30,0x21,0x30,0x09,0x06,0x05,
00021 0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14,0xBE,0x51,0xCB,0x68,0x11,0x92,0x4B,
00022 0x34,0xDF,0x08,0xE5,0x66,0xE6,0x70,0x14,0x10,0x12,0x6B,0x70,0x02,0x02,0x12,0x01,
00023 0x15,0x70,0x21,0x75,0xC0,0xBA,0xAF,0x52,0x9A,0x00,0x00,0x00,0x00,0x00,0x00,0x2F,
00024 0xC6,0x18,0x0F,0x32,0x30,0x30,0x37,0x31,0x30,0x30,0x39,0x31,0x35,0x30,0x36,0x34,
00025 0x30,0x5A,0xA0,0x82,0x02,0x2D,0x30,0x82,0x02,0x29,0x30,0x82,0x01,0x92,0xA0,0x03,
00026 0x02,0x01,0x02,0x02,0x04,0x2B,0x58,0xF2,0xF2,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,
00027 0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x43,0x31,0x0B,0x30,0x09,0x06,0x03,
00028 0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x0A,
00029 0x13,0x08,0x43,0x79,0x67,0x6E,0x61,0x63,0x6F,0x6D,0x31,0x12,0x30,0x10,0x06,0x03,
00030 0x55,0x04,0x0B,0x13,0x09,0x50,0x4B,0x49,0x46,0x20,0x54,0x65,0x73,0x74,0x31,0x0D,
00031 0x30,0x0B,0x06,0x03,0x55,0x04,0x03,0x13,0x04,0x54,0x53,0x41,0x31,0x30,0x1E,0x17,
00032 0x0D,0x30,0x37,0x30,0x36,0x31,0x35,0x31,0x36,0x32,0x37,0x32,0x39,0x5A,0x17,0x0D,
00033 0x31,0x37,0x30,0x36,0x31,0x35,0x31,0x36,0x32,0x37,0x32,0x39,0x5A,0x30,0x43,0x31,
00034 0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x11,0x30,0x0F,
00035 0x06,0x03,0x55,0x04,0x0A,0x13,0x08,0x43,0x79,0x67,0x6E,0x61,0x63,0x6F,0x6D,0x31,
00036 0x12,0x30,0x10,0x06,0x03,0x55,0x04,0x0B,0x13,0x09,0x50,0x4B,0x49,0x46,0x20,0x54,
00037 0x65,0x73,0x74,0x31,0x0D,0x30,0x0B,0x06,0x03,0x55,0x04,0x03,0x13,0x04,0x54,0x53,
00038 0x41,0x31,0x30,0x81,0x9F,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,
00039 0x01,0x01,0x05,0x00,0x03,0x81,0x8D,0x00,0x30,0x81,0x89,0x02,0x81,0x81,0x00,0xA5,
00040 0x01,0x2E,0x5C,0xE4,0xDB,0x9C,0xB8,0x13,0x77,0x50,0xE9,0x18,0x10,0x8A,0x84,0xD0,
00041 0x9C,0xF7,0xE7,0xED,0x5A,0x2B,0x46,0x3B,0xB3,0xD9,0xA5,0x54,0x5F,0xB2,0x5A,0x23,
00042 0x62,0xB4,0x06,0xD1,0x97,0xF4,0x39,0x90,0x64,0x8F,0x23,0xE7,0xAB,0xFA,0xFC,0x34,
00043 0x6B,0x0F,0xE3,0x73,0xC2,0x17,0xF2,0x9E,0x8B,0xB6,0xC1,0xBB,0x81,0x3A,0x77,0x56,
00044 0x7A,0x99,0x84,0xE6,0xB2,0x73,0xE8,0x21,0xFA,0x78,0x93,0x63,0xC5,0x1D,0x83,0x57,
00045 0xB2,0x6C,0xD0,0xE5,0xFD,0x70,0x2E,0x86,0xD3,0xB4,0xFC,0x37,0x2D,0x6E,0xCC,0xE2,
00046 0xE4,0xD8,0x4A,0xAA,0x75,0x6B,0x54,0x93,0xFC,0x9E,0xE8,0xCC,0xB1,0x30,0x0D,0xF9,
00047 0x2A,0x93,0x4B,0x8D,0xE8,0x30,0xD7,0xB4,0xFD,0x83,0x6A,0x52,0x10,0x2F,0x31,0x02,
00048 0x03,0x01,0x00,0x01,0xA3,0x2A,0x30,0x28,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,
00049 0x01,0xFF,0x04,0x04,0x03,0x02,0x07,0x80,0x30,0x16,0x06,0x03,0x55,0x1D,0x25,0x01,
00050 0x01,0xFF,0x04,0x0C,0x30,0x0A,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x08,
00051 0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,
00052 0x81,0x81,0x00,0x3F,0x00,0xFE,0x84,0x1E,0x84,0x7B,0xA6,0xB2,0xA9,0x92,0x0F,0x9E,
00053 0xA9,0x61,0xF4,0x01,0xEF,0x9E,0xC3,0xA4,0xF1,0xF8,0xB8,0xED,0x9B,0xB4,0xD0,0x19,
00054 0x1C,0xBD,0xDB,0x24,0xED,0xD1,0x3C,0xC3,0xAF,0x65,0x27,0x09,0xC1,0x9B,0x71,0x7A,
00055 0xB5,0x35,0xD5,0x4E,0x43,0x8B,0xAF,0x1E,0x7C,0x2F,0x18,0x77,0x89,0x37,0x2D,0xC6,
00056 0x76,0x65,0x89,0x51,0x75,0xB1,0x51,0x17,0x0C,0x22,0x6D,0x8F,0x17,0x30,0x29,0xFF,
00057 0x7F,0x41,0x5E,0x27,0x69,0x75,0x40,0xF0,0x0D,0x37,0xC5,0x2D,0x82,0x52,0xD8,0x15,
00058 0x1C,0x9E,0x17,0x46,0xAF,0xC6,0x81,0xAE,0x97,0x8B,0x20,0x29,0xEE,0xF0,0x3E,0x1D,
00059 0x6D,0xAC,0xA3,0xD6,0xA5,0x5D,0x4B,0x5D,0xE2,0x6C,0x25,0xE6,0xB9,0x50,0x68,0xC8,
00060 0x61,0x22,0x6C,0x31,0x82,0x01,0xD1,0x30,0x82,0x01,0xCD,0x02,0x01,0x01,0x30,0x4B,
00061 0x30,0x43,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,
00062 0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x0A,0x13,0x08,0x43,0x79,0x67,0x6E,0x61,0x63,
00063 0x6F,0x6D,0x31,0x12,0x30,0x10,0x06,0x03,0x55,0x04,0x0B,0x13,0x09,0x50,0x4B,0x49,
00064 0x46,0x20,0x54,0x65,0x73,0x74,0x31,0x0D,0x30,0x0B,0x06,0x03,0x55,0x04,0x03,0x13,
00065 0x04,0x54,0x53,0x41,0x31,0x02,0x04,0x2B,0x58,0xF2,0xF2,0x30,0x09,0x06,0x05,0x2B,
00066 0x0E,0x03,0x02,0x1A,0x05,0x00,0xA0,0x81,0xDD,0x30,0x1A,0x06,0x09,0x2A,0x86,0x48,
00067 0x86,0xF7,0x0D,0x01,0x09,0x03,0x31,0x0D,0x06,0x0B,0x2A,0x86,0x48,0x86,0xF7,0x0D,
00068 0x01,0x09,0x10,0x01,0x04,0x30,0x1C,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,
00069 0x09,0x05,0x31,0x0F,0x17,0x0D,0x30,0x37,0x31,0x30,0x30,0x39,0x31,0x35,0x30,0x36,
00070 0x34,0x30,0x5A,0x30,0x23,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x04,
00071 0x31,0x16,0x04,0x14,0xF1,0x20,0x25,0x9D,0x96,0x42,0x68,0x2A,0xCF,0x9C,0x5B,0x62,
00072 0x1E,0x22,0xD6,0x80,0x6F,0x3B,0x71,0x7E,0x30,0x7C,0x06,0x0B,0x2A,0x86,0x48,0x86,
00073 0xF7,0x0D,0x01,0x09,0x10,0x02,0x0C,0x31,0x6D,0x30,0x6B,0x30,0x69,0x30,0x67,0x04,
00074 0x14,0x40,0xC4,0xBB,0xE2,0x70,0xAE,0x6E,0xCD,0x47,0xDF,0xBB,0xC0,0x8E,0x3B,0xFE,
00075 0xD3,0x7A,0x94,0x29,0x1B,0x30,0x4F,0x30,0x47,0xA4,0x45,0x30,0x43,0x31,0x0B,0x30,
00076 0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x11,0x30,0x0F,0x06,0x03,
00077 0x55,0x04,0x0A,0x13,0x08,0x43,0x79,0x67,0x6E,0x61,0x63,0x6F,0x6D,0x31,0x12,0x30,
00078 0x10,0x06,0x03,0x55,0x04,0x0B,0x13,0x09,0x50,0x4B,0x49,0x46,0x20,0x54,0x65,0x73,
00079 0x74,0x31,0x0D,0x30,0x0B,0x06,0x03,0x55,0x04,0x03,0x13,0x04,0x54,0x53,0x41,0x31,
00080 0x02,0x04,0x2B,0x58,0xF2,0xF2,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,
00081 0x01,0x01,0x01,0x05,0x00,0x04,0x81,0x80,0x1F,0xF4,0x3E,0x64,0x02,0xC2,0x73,0xA8,
00082 0xC8,0xD7,0x0C,0x7B,0x19,0xBD,0x4D,0x3F,0xEF,0xEA,0x6E,0x93,0xF0,0x9B,0x54,0x6F,
00083 0x46,0xE7,0xF5,0xAD,0x95,0xB8,0x64,0xFD,0x71,0xF4,0x78,0x11,0x3F,0xD3,0xDE,0xB8,
00084 0x68,0xAF,0xD9,0x6B,0x39,0x0E,0x49,0x49,0x61,0x89,0xC2,0x60,0x6A,0x8C,0x05,0x3F,
00085 0xED,0x43,0xFC,0xEE,0x3F,0x3E,0x50,0xB4,0xBC,0xAF,0x53,0xB3,0xC8,0xD0,0xA4,0x4C,
00086 0x61,0x4A,0x38,0x88,0x88,0x31,0x5F,0x59,0x5A,0x34,0xCE,0x2B,0x2F,0x47,0xD4,0xF7,
00087 0x68,0x72,0x67,0xAF,0x4B,0xF3,0xA8,0x34,0xB4,0x7F,0xEC,0xA0,0xDB,0x7C,0xD5,0xAC,
00088 0x62,0xE9,0xF7,0x96,0x43,0x37,0xE6,0xC7,0xCB,0x29,0x95,0x1A,0x83,0x60,0x2B,0xF5,
00089 0xEC,0xD0,0x94,0x12,0x0E,0xAA,0x64,0x1F
00090 };
00091 
00092 int certDataLen = 622;
00093 unsigned char certData[] = {
00094 0x30,0x82,0x02,0x6A,0x30,0x82,0x01,0xD3,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x01,
00095 0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,
00096 0x3B,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x1A,
00097 0x30,0x18,0x06,0x03,0x55,0x04,0x0A,0x13,0x11,0x54,0x65,0x73,0x74,0x20,0x43,0x65,
00098 0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x73,0x31,0x10,0x30,0x0E,0x06,0x03,
00099 0x55,0x04,0x03,0x13,0x07,0x47,0x6F,0x6F,0x64,0x20,0x43,0x41,0x30,0x1E,0x17,0x0D,
00100 0x30,0x31,0x30,0x34,0x31,0x39,0x31,0x34,0x35,0x37,0x32,0x30,0x5A,0x17,0x0D,0x31,
00101 0x31,0x30,0x34,0x31,0x39,0x31,0x34,0x35,0x37,0x32,0x30,0x5A,0x30,0x4E,0x31,0x0B,
00102 0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x1A,0x30,0x18,0x06,
00103 0x03,0x55,0x04,0x0A,0x13,0x11,0x54,0x65,0x73,0x74,0x20,0x43,0x65,0x72,0x74,0x69,
00104 0x66,0x69,0x63,0x61,0x74,0x65,0x73,0x31,0x23,0x30,0x21,0x06,0x03,0x55,0x04,0x03,
00105 0x13,0x1A,0x56,0x61,0x6C,0x69,0x64,0x20,0x45,0x45,0x20,0x43,0x65,0x72,0x74,0x69,
00106 0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x54,0x65,0x73,0x74,0x31,0x30,0x81,0x9F,0x30,
00107 0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,
00108 0x8D,0x00,0x30,0x81,0x89,0x02,0x81,0x81,0x00,0xAD,0xA4,0xAB,0xBF,0x6B,0xA0,0xA8,
00109 0xEC,0xA7,0x0A,0x3B,0x29,0x9B,0xA0,0x40,0x3E,0x32,0x68,0x28,0xAF,0x25,0xC7,0x4F,
00110 0x57,0x71,0x13,0x19,0x90,0xD6,0x53,0xBB,0xC9,0xA8,0x76,0x2F,0xC8,0xFC,0x44,0x6E,
00111 0xA8,0xC7,0x94,0xEB,0xDF,0xB4,0xD5,0xF1,0x8D,0xB5,0xB6,0x2D,0xCC,0xA2,0x97,0x05,
00112 0x1F,0xE8,0x97,0x0D,0x25,0xF7,0xD5,0xF8,0xB1,0xB1,0x80,0x99,0x91,0xCA,0x63,0x30,
00113 0x8E,0x24,0x6E,0x35,0xE6,0x8C,0x63,0x9E,0x14,0xAB,0xB5,0xBE,0x76,0xC1,0x99,0xC6,
00114 0xF9,0x24,0x12,0x12,0x89,0x47,0xA0,0xDB,0x6B,0x48,0x44,0x5A,0x09,0xE3,0x34,0xE1,
00115 0x8B,0x71,0x8B,0x55,0xE7,0x06,0x8A,0x3C,0x8E,0x55,0x17,0x80,0xE4,0xB8,0x8F,0xCA,
00116 0x61,0x0A,0x1B,0xB7,0xC0,0x07,0x7D,0xB8,0xD7,0x02,0x03,0x01,0x00,0x01,0xA3,0x6B,
00117 0x30,0x69,0x30,0x1F,0x06,0x03,0x55,0x1D,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0xB7,
00118 0x2E,0xA6,0x82,0xCB,0xC2,0xC8,0xBC,0xA8,0x7B,0x27,0x44,0xD7,0x35,0x33,0xDF,0x9A,
00119 0x15,0x94,0xC7,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x3A,0xCC,
00120 0x94,0x65,0x0C,0x85,0xA9,0x3C,0xC1,0xE0,0xAF,0x51,0x33,0x2A,0x14,0x48,0x8F,0x9E,
00121 0x91,0x5B,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,
00122 0x04,0xF0,0x30,0x17,0x06,0x03,0x55,0x1D,0x20,0x04,0x10,0x30,0x0E,0x30,0x0C,0x06,
00123 0x0A,0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x30,0x01,0x30,0x0D,0x06,0x09,0x2A,
00124 0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x81,0x81,0x00,0xA4,0x68,
00125 0x67,0xC2,0xA9,0x88,0xB4,0xEB,0xCD,0x67,0xF4,0x38,0xAD,0xDF,0xA9,0x60,0xDD,0x4F,
00126 0xFD,0x81,0x36,0x68,0x36,0xA3,0xCC,0x68,0x06,0x8B,0x51,0x05,0x77,0x0A,0xBC,0xF1,
00127 0xC7,0x63,0x06,0x22,0x78,0x53,0xC8,0xA7,0x21,0x63,0x27,0x5B,0x57,0xC1,0xC3,0xF3,
00128 0xD3,0x76,0x8F,0x3C,0xD8,0xAB,0xB2,0x76,0x28,0xCF,0xD9,0x10,0x07,0xE3,0xB2,0x40,
00129 0x9D,0xB2,0x3D,0x52,0x88,0xC3,0x64,0x6D,0x86,0x5E,0xDE,0xB6,0x59,0x3A,0x57,0x6B,
00130 0x3C,0x21,0x85,0x83,0x35,0x06,0x4C,0xD6,0xA4,0x43,0x19,0x29,0xC5,0x4E,0x63,0xEE,
00131 0x99,0x62,0xBD,0x08,0x9C,0xFC,0xE6,0x7B,0xFA,0x63,0x13,0x8B,0x47,0xE7,0x8C,0x64,
00132 0x62,0xF4,0xCF,0x9A,0x6B,0xBE,0x38,0x56,0x61,0xFA,0x16,0x00,0xAD,0xD7
00133 };
00134 
00135 int crlDataLen = 382;
00136 unsigned char crlData[] = {
00137 0x30,0x82,0x01,0x7A,0x30,0x81,0xE4,0x02,0x01,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86,
00138 0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x3B,0x31,0x0B,0x30,0x09,0x06,
00139 0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x1A,0x30,0x18,0x06,0x03,0x55,0x04,
00140 0x0A,0x13,0x11,0x54,0x65,0x73,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,
00141 0x61,0x74,0x65,0x73,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x03,0x13,0x07,0x47,
00142 0x6F,0x6F,0x64,0x20,0x43,0x41,0x17,0x0D,0x30,0x31,0x30,0x34,0x31,0x39,0x31,0x34,
00143 0x35,0x37,0x32,0x30,0x5A,0x17,0x0D,0x31,0x31,0x30,0x34,0x31,0x39,0x31,0x34,0x35,
00144 0x37,0x32,0x30,0x5A,0x30,0x44,0x30,0x20,0x02,0x01,0x0E,0x17,0x0D,0x30,0x31,0x30,
00145 0x34,0x31,0x39,0x31,0x34,0x35,0x37,0x32,0x30,0x5A,0x30,0x0C,0x30,0x0A,0x06,0x03,
00146 0x55,0x1D,0x15,0x04,0x03,0x0A,0x01,0x01,0x30,0x20,0x02,0x01,0x0F,0x17,0x0D,0x30,
00147 0x31,0x30,0x34,0x31,0x39,0x31,0x34,0x35,0x37,0x32,0x30,0x5A,0x30,0x0C,0x30,0x0A,
00148 0x06,0x03,0x55,0x1D,0x15,0x04,0x03,0x0A,0x01,0x01,0xA0,0x2F,0x30,0x2D,0x30,0x1F,
00149 0x06,0x03,0x55,0x1D,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0xB7,0x2E,0xA6,0x82,0xCB,
00150 0xC2,0xC8,0xBC,0xA8,0x7B,0x27,0x44,0xD7,0x35,0x33,0xDF,0x9A,0x15,0x94,0xC7,0x30,
00151 0x0A,0x06,0x03,0x55,0x1D,0x14,0x04,0x03,0x02,0x01,0x01,0x30,0x0D,0x06,0x09,0x2A,
00152 0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x81,0x81,0x00,0x93,0xC2,
00153 0xEC,0x0B,0x71,0x07,0x2D,0x9D,0xD7,0xA2,0xB3,0xF0,0xED,0x08,0x4D,0x6E,0x06,0x90,
00154 0x66,0x72,0x06,0xA9,0xC2,0x30,0x73,0xF1,0x18,0x72,0xBF,0xA7,0x51,0x13,0x95,0xC4,
00155 0x31,0x3F,0x1D,0x79,0x41,0xED,0xED,0xAB,0xD0,0x96,0x11,0x1E,0x32,0x47,0x4C,0xC4,
00156 0xF7,0xE2,0x08,0x65,0x6F,0x73,0x55,0xC1,0x59,0x09,0x56,0xF2,0x60,0x79,0x27,0x18,
00157 0x2E,0x94,0x40,0xDD,0x7E,0xB1,0x92,0xBF,0xB8,0x57,0xE5,0x4C,0xC5,0x38,0x97,0x75,
00158 0x2A,0xA1,0x17,0xA2,0x25,0x0D,0xEC,0x0E,0xB7,0x95,0x40,0x8D,0x2C,0xDF,0xB9,0xFA,
00159 0x10,0xFF,0xBE,0x9E,0x4A,0xF2,0x37,0x4F,0x25,0xCB,0x1B,0xC8,0x6D,0xEF,0xE4,0x09,
00160 0xB9,0x03,0x36,0x1B,0xC1,0xD9,0xF9,0x4F,0x00,0x5E,0x80,0x85,0x92,0xCD
00161 };
00162 
00163 int eccCertDataLen = 499;
00164 unsigned char eccCertData[] = {
00165 0x30,0x82,0x01,0xEF,0x30,0x82,0x01,0x73,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x02,
00166 0x30,0x0C,0x06,0x08,0x2A,0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x05,0x00,0x30,0x36,
00167 0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x0D,0x30,
00168 0x0B,0x06,0x03,0x55,0x04,0x0A,0x13,0x04,0x54,0x65,0x73,0x74,0x31,0x18,0x30,0x16,
00169 0x06,0x03,0x55,0x04,0x03,0x13,0x0F,0x45,0x43,0x44,0x53,0x41,0x20,0x54,0x65,0x73,
00170 0x74,0x32,0x20,0x43,0x41,0x31,0x30,0x1E,0x17,0x0D,0x30,0x31,0x30,0x34,0x31,0x39,
00171 0x31,0x34,0x35,0x37,0x32,0x30,0x5A,0x17,0x0D,0x31,0x31,0x30,0x34,0x31,0x39,0x31,
00172 0x34,0x35,0x37,0x32,0x30,0x5A,0x30,0x36,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,
00173 0x06,0x13,0x02,0x55,0x53,0x31,0x0D,0x30,0x0B,0x06,0x03,0x55,0x04,0x0A,0x13,0x04,
00174 0x54,0x65,0x73,0x74,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x03,0x13,0x0F,0x45,
00175 0x43,0x44,0x53,0x41,0x20,0x54,0x65,0x73,0x74,0x32,0x20,0x45,0x45,0x31,0x30,0x76,
00176 0x30,0x10,0x06,0x07,0x2A,0x86,0x48,0xCE,0x3D,0x02,0x01,0x06,0x05,0x2B,0x81,0x04,
00177 0x00,0x22,0x03,0x62,0x00,0x04,0x25,0x16,0x25,0xC4,0x27,0xB0,0x3B,0xF9,0xA6,0x1C,
00178 0x4D,0x3A,0x45,0xA3,0xDC,0xDD,0xB8,0xFB,0xA0,0x17,0x35,0xC6,0x67,0xFF,0x31,0xCD,
00179 0x2E,0x8C,0x1F,0x0C,0x4B,0x19,0xD1,0x59,0x35,0x59,0xD6,0xC8,0xC3,0xD5,0x22,0xB3,
00180 0x73,0xFA,0xDC,0x9E,0xA5,0x4B,0xD6,0x7E,0xA9,0xF3,0xE3,0x11,0x49,0x8D,0xF8,0x65,
00181 0x1C,0x61,0xCF,0x2A,0xEC,0x0E,0xBF,0xA6,0x2A,0xF9,0x07,0x5C,0x30,0x44,0xC3,0x53,
00182 0x17,0xD9,0xB3,0x4E,0xC4,0xE0,0xC4,0x79,0x7A,0xCE,0x6A,0x05,0x4E,0x9E,0xC3,0xCF,
00183 0xEF,0x79,0x97,0x2F,0x14,0x9A,0xA3,0x53,0x30,0x51,0x30,0x11,0x06,0x03,0x55,0x1D,
00184 0x0E,0x04,0x0A,0x04,0x08,0xC3,0xCF,0xEF,0x79,0x97,0x2F,0x14,0x9A,0x30,0x13,0x06,
00185 0x03,0x55,0x1D,0x23,0x04,0x0C,0x30,0x0A,0x80,0x08,0xDF,0x59,0x4B,0xB3,0x65,0x3E,
00186 0xEA,0x6E,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,
00187 0x04,0xF0,0x30,0x17,0x06,0x03,0x55,0x1D,0x20,0x04,0x10,0x30,0x0E,0x30,0x0C,0x06,
00188 0x0A,0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x30,0x01,0x30,0x0C,0x06,0x08,0x2A,
00189 0x86,0x48,0xCE,0x3D,0x04,0x03,0x03,0x05,0x00,0x03,0x68,0x00,0x30,0x65,0x02,0x31,
00190 0x00,0x85,0x0E,0x4D,0x0E,0x88,0x52,0x34,0x6F,0x87,0xE5,0x89,0x53,0x9C,0x5A,0x24,
00191 0xE0,0x9A,0xBD,0x89,0x9C,0x4D,0xF9,0x39,0xA1,0xC2,0xBE,0x40,0xFD,0x25,0x10,0x44,
00192 0x72,0x88,0x2B,0x63,0x6C,0xF8,0x76,0x78,0x0B,0xB6,0xC1,0x19,0x46,0xB7,0x70,0x31,
00193 0x9F,0x02,0x30,0x5F,0x64,0xFC,0x9D,0x19,0xE1,0xB8,0x01,0x47,0xF6,0x89,0x7A,0xEF,
00194 0xDF,0x29,0x69,0x64,0x3F,0x95,0xFC,0xB1,0xE6,0x1A,0x74,0xAC,0xCB,0x49,0x86,0xB6,
00195 0xFF,0xAF,0x37,0x54,0x21,0x39,0x57,0xD2,0xC1,0x27,0x0E,0x20,0xF8,0x4F,0x30,0xA4,
00196 0x9F,0x0A,0x2F
00197 };
00198 
00199 int _tmain(int argc, _TCHAR* argv[])
00200 {
00201     CPKIFBufferPtr dataBuf(new CPKIFBuffer(data, dataLen));
00202 
00203     CPKIFCertificatePtr cert(new CPKIFCertificate());
00204     cert->Decode(certData, certDataLen);
00205     CPKIFCRLPtr crl(new CPKIFCRL());
00206     crl->Decode(crlData, crlDataLen);
00207 
00208     CPKIFCertificatePtr eccCert(new CPKIFCertificate());
00209     eccCert->Decode(eccCertData, eccCertDataLen);
00210     CPKIFSubjectPublicKeyInfoPtr spki = eccCert->SubjectPublicKeyInfo();
00211 
00212     CPKIFEvidenceRecord ers;
00213     ers.Decode(dataBuf);
00214     ers.GetArchiveTimestampSequence();
00215     ers.GetDigestAlgorithms();
00216     ers.GetVersion();
00217     CPKIFBufferPtr copy = ers.Encode();
00218 
00219     if(*copy != *dataBuf)
00220     {
00221         int x = 00;
00222         bool xx = false;
00223     }
00224 
00225     CPKIFSecuritySuitabilityPolicy ssp;
00226     ssp.OpenPolicy("D:\\SubversionCheckouts\\SBIR\\\\docs\\Design Docs\\schemas\\dssc.xml");
00227     ssp.SetTimeOfInterest(CPKIFTime::CurrentTime());
00228     CPKIFAlgorithmIdentifierListPtr algList;
00229     CPKIFArchiveTimestampSequencePtr atsSeq;
00230 
00231     atsSeq = ers.GetArchiveTimestampSequence();
00232     algList = ers.GetDigestAlgorithms();
00233 
00234     std::string alg = ((*algList)[0])->oid()->ToString();
00235     bool f = ssp.IsAlgorithmSuitable((*algList)[0]);
00236 
00237     bool f2 = ssp.AreAlgorithmsInCertificateSuitable(cert);
00238     bool f3 = ssp.AreAlgorithmsInCrlSuitable(crl);
00239 
00240     CPKIFArchiveTimestampSequence::iterator pos;
00241     CPKIFArchiveTimestampSequence::iterator end = atsSeq->end();
00242     for(pos = atsSeq->begin(); pos != end; ++pos)
00243     {
00244         CPKIFArchiveTimestampChainPtr atsChain = *pos;
00245         CPKIFArchiveTimestampChain::iterator chainPos;
00246         CPKIFArchiveTimestampChain::iterator chainEnd = atsChain->end();
00247         for(chainPos = atsChain->begin(); chainPos != chainEnd; ++chainPos)
00248         {
00249             CPKIFArchiveTimestampPtr ats = *chainPos;
00250 
00251             CPKIFContentInfoPtr ci = ats->GetTimestamp();
00252             CPKIFAlgorithmIdentifierPtr digAlg = ats->GetDigestAlgorithm();
00253 
00254             CPKIFBufferPtr contentBP = ci->GetContent();
00255             const unsigned char* contentBuf = contentBP->GetBuffer();
00256             int contentLen = contentBP->GetLength();
00257 
00258             CPKIFSignedData sd;
00259             sd.Decode(contentBP);
00260             
00261             CPKIFEncapsulatedContentInfoPtr ecip = sd.GetEncapsulatedContent();
00262             CPKIFBufferPtr timestampBP = ecip->GetContent();
00263 
00264             CPKIFTSTInfo tstInfo;
00265             tstInfo.Decode(timestampBP);
00266         }
00267     }
00268 
00269     return 0;
00270 }
00271 

Generated on Mon Nov 15 11:15:54 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6