2 * Test program for GDSS.
9 char TestMessage[] = "This is a test message. This is only a test.";
11 unsigned char OldSig[] = { 0x44, 0x6a, 0x69, 0x73, 0x20, 0x21, 0x20,
12 0x21, 0x41, 0x54, 0x48, 0x45, 0x4e, 0x41, 0x2e, 0x4d, 0x49, 0x54,
13 0x2e, 0x45, 0x44, 0x55, 0x20, 0x21, 0x2a, 0x13, 0x28, 0x97, 0x2b,
14 0x47, 0xad, 0xcc, 0xb0, 0xe1, 0x11, 0x71, 0xc1, 0x48, 0xa5, 0xd1,
15 0x1e, 0xa6, 0x20, 0x20, 0x97, 0x3d, 0xcb, 0x73, 0xf3, 0x63, 0x52,
16 0x3b, 0x2c, 0x7f, 0x05, 0x30, 0xe0, 0x03, 0x75, 0x9e, 0x0c, 0xa7,
17 0xdc, 0xf2, 0x41, 0x89, 0x95, 0xb1, 0x4e, 0xe1, 0x11, 0xba, 0x05,
18 0x39, 0xd1, 0xf1, 0x74, 0x96, 0x7f, 0xa2, 0xaf, 0x40, 0xc3, 0x70,
19 0x5a, 0x39, 0xa0, 0xce, 0x8a, 0xfd, 0x1c, 0xed, 0xcc, 0x00 };
29 printf("Performing Test Signature....");
30 status = GDSS_Sign(TestMessage, strlen(TestMessage), Signature);
31 if (status != GDSS_SUCCESS) {
33 if (status == GDSS_E_TIMEDOUT)
34 printf("Signature Server Request timed out (is it running?)!\n");
35 else printf("GDSS_Sign Error number: %d\n", status);
41 memset(&aSigInfo, 0, sizeof(aSigInfo));
43 printf("Attempting to Verify signature...");
44 status = GDSS_Verify(TestMessage, strlen(TestMessage), Signature,
46 if (status != GDSS_SUCCESS) {
48 printf("GDSS_Verify Error number: %d\n", status);
52 printf("Signature by: %s.%s@%s at %s\n",
53 aSigInfo.pname, aSigInfo.pinst, aSigInfo.prealm,
54 ctime(&aSigInfo.timestamp));
57 printf("Purposely damaging data...test: ");
61 status = GDSS_Verify(TestMessage, strlen(TestMessage), Signature,
63 if (status == GDSS_SUCCESS) {
65 printf("Signature succeeded when it should *not* have!\n");
67 } else if (status != GDSS_E_BADSIG) {
69 printf("Signature failed, but returned error code %d\n", status);
75 printf("Fixing data...\n");
79 printf("Attempting to Verify signature...");
80 status = GDSS_Verify(TestMessage, strlen(TestMessage), Signature,
82 if (status != GDSS_SUCCESS) {
84 printf("GDSS_Verify Error number: %d\n", status);
88 printf("Signature by: %s.%s@%s at %s\n",
89 aSigInfo.pname, aSigInfo.pinst, aSigInfo.prealm,
90 ctime(&aSigInfo.timestamp));
93 printf("Testing Builtin Signature...\n");
95 printf("Attempting to Verify signature...");
97 status = GDSS_Verify(TestMessage, strlen(TestMessage), OldSig,
99 if (status != GDSS_SUCCESS) {
101 printf("GDSS_Verify Error number: %d\n", status);
105 printf("Signature by: %s.%s@%s at %s\n",
106 aSigInfo.pname, aSigInfo.pinst, aSigInfo.prealm,
107 ctime(&aSigInfo.timestamp));
110 printf("All Test Passed.\n");