23 #include <seclabel_api.h>
28 static char *optstr =
"u37m:d:p:w:M:D:P:W:r:o:O:r:g:G:c:l:R:y:C:iaqsAve:x:b:f:S:Y:Z4U:L:";
31 static char *default_recip =
"/CN=lppt1/OU=lppt/O=attlee/PRMD=TestPRMD/ADMD=TestADMD/C=GB/";
33 static char *content_id =
"030924.140212";
34 static const char text[] =
"First line\r\nSecond line\r\n";
35 static char *binary_data;
37 const char* xml_filename =
"seclabel.xml";
39 static int setup_msg_sec_env = 0;
41 int num_unsigned_rcvd;
42 int num_unverified_rcvd;
43 int num_verified_rcvd;
47 static void usage(
void) ;
55 static int submit_msg(
57 struct X400msSession *sp
61 struct X400msSession *sp
64 static int setup_default_new_sec_env(
65 struct X400msSession *sp,
66 char *identity_filename,
70 static int setup_default_old_sec_env(
71 struct X400msSession *sp,
77 static int setup_msg_new_sec_env(
78 struct X400msMessage *mp,
79 char *identity_filename,
83 static int add_x411_label(
84 struct X400msMessage *mp,
85 const char* xml_filename
88 static int add_4066_label(
89 struct X400msMessage *mp,
90 const char* xml_filename
93 static int setup_msg_old_sec_env(
94 struct X400msMessage *mp,
100 static int report_moac_info(
101 struct X400msMessage *mp
104 static void show_4406_certificate (
struct X400msMessage *mp);
105 static void show_certificate (
struct X400msMessage *mp);
106 static int report_4406_info(
107 struct X400msMessage *mp
110 static void print_sec_label(
128 char password[BUFSIZ];
130 if (get_args(argc, argv, optstr)) {
135 printf(
"Connection type (0 = P7, 1 = P3 submit only, 2 = P3 both directions) [%d]: ", x400_contype);
136 contype = ic_fgetc(x400_contype, stdin);
138 ic_fgetc(x400_contype, stdin);
140 if ( contype <
'0' ||
'2' < contype )
141 contype = x400_contype;
146 def_oraddr = x400_ms_user_addr;
147 def_dn = x400_ms_user_dn;
148 def_pa = x400_ms_presentation_address;
150 def_oraddr = x400_mta_user_addr;
151 def_dn = x400_mta_user_dn;
152 def_pa = x400_mta_presentation_address;
155 printf(
"Your ORAddress [%s] > ", def_oraddr);
156 ic_fgets (orn,
sizeof orn, stdin);
158 if ( orn[strlen(orn)-1] ==
'\n' )
159 orn[strlen(orn)-1] =
'\0';
162 strcpy(orn, def_oraddr);
165 printf (
"Password [%s]: ",
166 contype == 0 ? x400_p7_password : x400_p3_password);
167 if ( ic_fgets (password,
sizeof password, stdin) == NULL )
170 if (password[strlen(password)-1] ==
'\n' )
171 password[strlen(password)-1] =
'\0';
172 if (password[0] ==
'\0')
173 strcpy(password, contype == 0 ? x400_p7_password : x400_p3_password);
176 printf(
"Presentation Address [%s] > ", def_pa);
177 ic_fgets (pa,
sizeof pa, stdin);
179 if ( pa[strlen(pa)-1] ==
'\n' )
180 pa[strlen(pa)-1] =
'\0';
185 printf(
"sending message using session 1\n");
186 if ((status = send_msg(contype, orn, def_dn, pa, password))
188 fprintf (stderr,
"Error in sending message\n");
191 printf(
"sending message using session 2\n");
192 if ((status = send_msg(contype, orn, def_dn, pa, password))
194 fprintf (stderr,
"Error sending message\n");
208 struct X400msSession *sp;
214 status =
X400msOpen (contype, orn, def_dn, password, pa, NULL, &sp);
216 fprintf (stderr,
"Error in Open: %s\n",
X400msError (status));
217 fprintf (stderr,
"%s %s %s\n", orn, def_dn, pa);
236 if (use_new_sec_env) {
237 status = setup_default_new_sec_env(sp, identity_filename, passphrase);
239 status = setup_default_old_sec_env(sp, security_id, identity_dn,
244 fprintf (stderr,
"Can't setup security environment\n");
248 printf(
"sending message 1\n");
249 status = submit_msg(orn, sp);
251 fprintf (stderr,
"Can't submit\n");
255 printf(
"sending message 2\n");
256 status = submit_msg(orn, sp);
258 fprintf (stderr,
"Can't submit\n");
262 printf(
"sending message 3\n");
263 status = submit_msg(orn, sp);
265 fprintf (stderr,
"Can't submit\n");
270 status = get_msg(sp);
272 fprintf(stderr,
"Error in getting msg: %s\n",
279 fprintf (stderr,
"X400msClose returned error: %s\n",
X400msError (status));
285 static int submit_msg(
287 struct X400msSession *sp
290 struct X400msMessage *mp;
291 struct X400Recipient *rp;
297 if (x400_default_recipient != NULL)
298 recip = x400_default_recipient;
300 recip = default_recip;
302 printf(
"Message recipient [%s]: ", recip);
303 ic_fgets (tmp,
sizeof tmp, stdin);
305 if ( tmp[strlen(tmp)-1] ==
'\n' )
306 tmp[strlen(tmp)-1] =
'\0';
307 if (strlen(tmp) != 0)
310 printf(
"Subject [%s]: ", subject);
311 ic_fgets (tmp,
sizeof tmp, stdin);
313 if ( tmp[strlen(tmp)-1] ==
'\n' )
314 tmp[strlen(tmp)-1] =
'\0';
315 if (strlen(tmp) != 0)
316 subject = strdup(tmp);
320 fprintf (stderr,
"x400msMsgNew returned error: %s\n",
X400msError (status));
337 if (setup_msg_sec_env) {
338 if (use_new_sec_env) {
339 status = setup_msg_new_sec_env(mp, identity_filename, passphrase);
341 fprintf (stderr,
"Can't setup new security environment\n");
345 status = setup_msg_old_sec_env(mp, security_id, identity_dn2,
348 fprintf (stderr,
"Can't setup old security environment\n");
363 fprintf (stderr,
"x400msMsgAddStrParam returned error: %s\n",
376 printf(
"\nRequesting 4406 signature\n");
379 fprintf (stderr,
"x400msMsgAddStrParam returned error: %s\n",
X400msError (status));
384 printf(
"\nAdding 4406 label\n");
385 status = add_4066_label (mp, xml_filename);
387 fprintf (stderr,
"add_4406_label returned error: %s\n",
393 printf(
"\nNot requesting 4406 signature\n");
396 if (need_x411_label) {
397 status = add_x411_label (mp, xml_filename);
399 fprintf (stderr,
"add_x411_label returned error: %s\n",
404 printf(
"\nNot requesting X.411 Label\n");
409 fprintf (stderr,
"x400msRecipNew returned error: %s\n",
X400msError (status));
415 fprintf (stderr,
"x400msRecipAddStrParam returned error: %s\n",
X400msError (status));
421 fprintf (stderr,
"x400msRecipAddStrParam returned error: %s\n",
X400msError (status));
427 fprintf (stderr,
"x400msMsgAddStrParam returned error: %s\n",
X400msError (status));
433 fprintf (stderr,
"x400msMsgAddStrParam returned error: %s\n",
X400msError (status));
440 fprintf (stderr,
"x400msRecipAddStrParam returned error: %s\n",
X400msError (status));
447 fprintf (stderr,
"x400msRecipAddStrParam returned error: %s\n",
X400msError (status));
454 fprintf (stderr,
"x400msMsgAddStrParam returned error: %s\n",
X400msError (status));
460 fprintf (stderr,
"x400msMsgAddStrParam returned error: %s\n",
X400msError (status));
466 fprintf (stderr,
"x400ms returned error: %s\n",
X400msError (status));
473 printf(
"failed to add X400_T_IA5TEXT BP\n");
478 if (filename_to_send != NULL) {
479 binary_data = (
char *) malloc(100000);
480 if ( binary_data == NULL )
482 fp = fopen(filename_to_send,
"r");
483 if (fp == (FILE *)NULL) {
484 printf(
"Cannot open binary file\n");
487 if ((fs = fread (binary_data,
sizeof(
char), 100000/
sizeof(
char), fp) ) == -1) {
488 printf(
"Cannot read from binary file\n");
495 printf(
"failed to add X400_T_BINARY BP\n");
499 printf(
"no binary file set - not sending X400_T_BINARY\n");
504 fprintf (stderr,
"x400msMsgSend returned error: %s\n",
X400msError (status));
507 printf(
"Message submitted successfully\n");
512 fprintf (stderr,
"x400msMsgDelete returned error: %s\n",
X400msError (status));
523 static int setup_default_new_sec_env(
524 struct X400msSession *sp,
535 fprintf (stderr,
"X400msSetStrDefault returned error: %s\n",
543 fprintf (stderr,
"X400msSetStrDefault returned error: %s\n",
551 fprintf (stderr,
"X400msTestSecurityEnv returned error: %s\n",
559 static int setup_default_old_sec_env(
560 struct X400msSession *sp,
577 fprintf (stderr,
"X400msSetStrDefault returned error: %s\n",
585 fprintf (stderr,
"X400msSetStrDefault returned error: %s\n",
593 static int setup_msg_new_sec_env(
594 struct X400msMessage *mp,
605 fprintf (stderr,
"X400msMsgAddStrParam returned error: %s\n",
613 fprintf (stderr,
"x400msMsgAddStrParam returned error: %s\n",
620 static int setup_msg_old_sec_env(
621 struct X400msMessage *mp,
635 fprintf (stderr,
"x400msMsgAddStrParam returned error: %s\n",
643 fprintf (stderr,
"x400msMsgAddStrParam returned error: %s\n",
651 fprintf (stderr,
"x400msMsgAddStrParam returned error: %s\n",
659 static int add_4066_label(
660 struct X400msMessage *mp,
665 #define XML_BUFSIZE 1024
666 #define STRING_BUFSIZE 1024
669 char xml_content[XML_BUFSIZE];
670 char str_content[STRING_BUFSIZE];
671 int str_len = STRING_BUFSIZE;
674 printf(
"Adding 4406 Security Label, using file %s\n", filename);
676 fd = fopen(filename,
"r");
678 fprintf(stderr,
"Failed to open %s : %s\n",
679 filename,strerror(errno));
682 fread(&xml_content,XML_BUFSIZE,1,fd);
686 status = SecLabelInit(
"Example program 2");
687 if (status != SECLABEL_E_NOERROR) {
688 fprintf(stderr,
"SecLabelInit returned error %d\n", status);
693 status = SecLabelParse(xml_content,
698 if (status != SECLABEL_E_NOERROR) {
699 fprintf(stderr,
"SecLabelParse returned error %d\n", status);
705 str_content,str_len);
707 fprintf (stderr,
"x400msMsgAddStrParam returned error: %s\n",
716 static int add_x411_label(
717 struct X400msMessage *mp,
722 #define XML_BUFSIZE 1024
723 #define STRING_BUFSIZE 1024
726 char xml_content[XML_BUFSIZE];
727 char str_content[STRING_BUFSIZE];
728 int str_len = STRING_BUFSIZE;
731 printf(
"Adding X.411 Security Label, using file %s\n", filename);
733 fd = fopen(filename,
"r");
735 fprintf(stderr,
"Failed to open %s : %s\n",
736 filename,strerror(errno));
739 fread(&xml_content,XML_BUFSIZE,1,fd);
743 status = SecLabelInit(
"Example program");
744 if (status != SECLABEL_E_NOERROR) {
745 fprintf(stderr,
"SecLabelInit returned error %d\n", status);
750 status = SecLabelParse(xml_content,
755 if (status != SECLABEL_E_NOERROR) {
756 fprintf(stderr,
"SecLabelParse returned error %d\n", status);
762 str_content,str_len);
764 fprintf (stderr,
"x400msMsgAddStrParam returned error: %s\n",
774 struct X400msSession *sp
782 struct X400msMessage *mp;
783 struct X400Recipient *rp;
787 char recipient_str[BUFSIZ];
789 printf(
"Waiting for new messages for 10 seconds\n");
792 fprintf(stderr,
"Error from Wait: %s\n",
X400msError(status));
827 if (x400_default_recipient != NULL)
828 printf(
"Getting message\n");
832 fprintf(stderr,
"MsgGet successfully got message\n");
835 fprintf(stderr,
"Error from MsgGet: %s\n",
X400msError(status));
843 fprintf(stderr,
"Got a report (printing only some attributes)\n");
847 buffer,
sizeof buffer, &length);
849 fprintf(stderr,
"Error from MsgGetStrParam: %s\n",
855 printf(
"Subject Identifier: %.*s\n", (
int)length, buffer);
863 fprintf(stderr,
"Error from RecipGet: %s\n",
873 sizeof recipient_str, &length);
875 fprintf(stderr,
"Error from RecipGetStrParam: %s\n",
882 printf(
"Positive Delivery Report for recipient %d: %.*s\n", n,
883 (
int)length, recipient_str);
888 buffer,
sizeof buffer, &length);
891 printf(
"Delivery Time: %.*s\n", (
int)length, buffer);
895 printf(
"Negative Delivery Report for recipient %d: %s\n", n,
900 buffer,
sizeof buffer,
903 fprintf(stderr,
"Error from RecipGetStrParam: %s\n",
907 printf(
"Supplementary Info: %.*s\n", (
int)length, buffer);
914 fprintf(stderr,
"Error from MsgGetIntParam: %s\n",
917 printf(
"Non-Delivery Reason: %d\n", intparam);
924 fprintf(stderr,
"Error from MsgGetIntParam: %s\n",
927 printf(
"Non-Delivery Diagnostic: %d\n", intparam);
931 num_unsigned_rcvd++ ;
934 fprintf(stderr,
"Error from X400msMsgDelete: %s\n",
943 buffer,
sizeof buffer, &length);
945 printf(
"No X.411 security label\n");
947 fprintf(stderr,
"Failed to fetch X.411 security label: %d (%s)",
951 fprintf(stderr,
"X.411 Security Label returned OK (%d chars)\n",
953 print_sec_label(buffer, length);
957 report_moac_info(mp);
960 report_4406_info(mp);
964 buffer,
sizeof buffer, &length);
966 fprintf(stderr,
"Error from MsgGetStrParam: %s\n",
972 printf(
"Message Identifier: %.*s\n", (
int)length, buffer);
976 buffer,
sizeof buffer, &length);
978 fprintf(stderr,
"Error from MsgGetStrParam: %s\n",
984 printf(
"Originator: %.*s\n", (
int)length, buffer);
992 fprintf(stderr,
"Error from RecipGet: %s\n",
X400msError(status));
1000 buffer,
sizeof buffer, &length);
1002 printf(
"Recipient %d: %.*s\n", n, (
int)length, buffer);
1008 buffer,
sizeof buffer, &length);
1010 printf(
"Subject: %.*s\n", (
int)length, buffer);
1014 buffer,
sizeof buffer, &length);
1016 printf(
"Text:\n%.*s\n", (
int)length, buffer);
1034 static void setup_default_new_sec_env(
1035 struct X400msSession *sp,
1036 char *trusted_ca_certs_dir
1042 printf(
" Adding %s as trusted CA cert dir\n", trusted_ca_certs_dir);
1044 trusted_ca_certs_dir, -1);
1046 fprintf (stderr,
"X400msSetStrDefault returned error: %s\n",
1063 static void setup_default_old_sec_env(
1064 struct X400msSession *sp,
1083 fprintf (stderr,
"X400msSetStrDefault returned error: %s\n",
1091 fprintf (stderr,
"X400msSetStrDefault returned error: %s\n",
1100 static int report_moac_info(
1101 struct X400msMessage *mp
1111 num_unverified_rcvd++ ;
1112 fprintf (stderr,
"No MOAC in message\n");
1116 num_unverified_rcvd++ ;
1117 fprintf (stderr,
"Unexpected error getting MOAC status: %s\n",
1122 fprintf (stderr,
"Have MOAC in message (%d)\n", intparam);
1126 "MsgGet successfully verified signature in message\n");
1127 show_certificate (mp);
1128 fprintf(stderr,
"continuing ...\n");
1129 num_verified_rcvd++ ;
1133 "MOAC validation cannot take place because the security environment is invalid (%d):\n",
1140 "MOAC validation cannot take place because the security environment is invalid (%d):\n",
1145 fprintf(stderr,
"Verification Error from MsgGet: %s\n",
1147 show_certificate (mp);
1148 fprintf(stderr,
"continuing ...\n");
1149 num_unverified_rcvd++ ;
1152 fprintf(stderr,
"Verification Error from MsgGet: %s\n",
1154 fprintf(stderr,
"continuing ...\n");
1155 num_unverified_rcvd++ ;
1158 fprintf(stderr,
"Verification Error from MsgGet: %s\n",
1160 show_certificate (mp);
1161 fprintf(stderr,
"continuing ...\n");
1162 num_unverified_rcvd++ ;
1165 fprintf(stderr,
"Verification Error from MsgGet: %s\n",
1167 show_certificate (mp);
1168 fprintf(stderr,
"continuing ...\n");
1169 num_unverified_rcvd++ ;
1172 fprintf(stderr,
"Verification Error from MsgGet: %s\n",
1174 show_certificate (mp);
1175 fprintf(stderr,
"continuing ...\n");
1176 num_unverified_rcvd++ ;
1179 fprintf(stderr,
"Verification Error from MsgGet: %s\n",
1181 show_certificate (mp);
1182 fprintf(stderr,
"continuing ...\n");
1183 num_unverified_rcvd++ ;
1186 fprintf(stderr,
"Verification Error from MsgGet: %s\n",
1188 show_certificate (mp);
1189 fprintf(stderr,
"continuing ...\n");
1190 num_unverified_rcvd++ ;
1193 fprintf(stderr,
"Unexpected verification error from MsgGet: %s\n",
1195 show_certificate (mp);
1196 fprintf(stderr,
"continuing ...\n");
1197 num_unverified_rcvd++ ;
1205 static int report_4406_info(
1206 struct X400msMessage *mp
1212 char buffer[BUFSIZ];
1218 num_unverified_rcvd++ ;
1219 fprintf (stderr,
"No 4406 signature in message\n");
1223 num_unverified_rcvd++ ;
1224 fprintf (stderr,
"Unexpected error getting 4406 signature status: %s\n",
1229 fprintf (stderr,
"Have 4406 signature in message (%d)\n", intparam);
1233 "MsgGet successfully verified signature in message\n");
1234 show_4406_certificate (mp);
1235 fprintf(stderr,
"continuing ...\n");
1236 num_verified_rcvd++ ;
1240 "4406 signature validation cannot take place because the security environment is invalid (%d):\n",
1247 "4406 signature validation cannot take place because the security environment is invalid (%d):\n",
1252 fprintf(stderr,
"Verification Error from MsgGet: %s\n",
1254 show_4406_certificate (mp);
1255 fprintf(stderr,
"continuing ...\n");
1256 num_unverified_rcvd++ ;
1259 fprintf(stderr,
"Verification Error from MsgGet: %s\n",
1261 fprintf(stderr,
"continuing ...\n");
1262 num_unverified_rcvd++ ;
1265 fprintf(stderr,
"Verification Error from MsgGet: %s\n",
1267 show_4406_certificate (mp);
1268 fprintf(stderr,
"continuing ...\n");
1269 num_unverified_rcvd++ ;
1272 fprintf(stderr,
"Verification Error from MsgGet: %s\n",
1274 show_4406_certificate (mp);
1275 fprintf(stderr,
"continuing ...\n");
1276 num_unverified_rcvd++ ;
1279 fprintf(stderr,
"Verification Error from MsgGet: %s\n",
1281 show_4406_certificate (mp);
1282 fprintf(stderr,
"continuing ...\n");
1283 num_unverified_rcvd++ ;
1286 fprintf(stderr,
"Verification Error from MsgGet: %s\n",
1288 show_4406_certificate (mp);
1289 fprintf(stderr,
"continuing ...\n");
1290 num_unverified_rcvd++ ;
1293 fprintf(stderr,
"Verification Error from MsgGet: %s\n",
1295 show_4406_certificate (mp);
1296 fprintf(stderr,
"continuing ...\n");
1297 num_unverified_rcvd++ ;
1300 fprintf(stderr,
"Unexpected verification error from MsgGet: %s\n",
1302 show_4406_certificate (mp);
1303 fprintf(stderr,
"continuing ...\n");
1304 num_unverified_rcvd++ ;
1311 buffer,
sizeof buffer, &length);
1313 printf(
"No 4406 security label\n");
1315 fprintf(stderr,
"Failed to fetch 4406 security label: %d (%s)",
1319 fprintf(stderr,
"4406 Security Label returned OK (%d chars)\n",
1321 print_sec_label(buffer, length);
1326 buffer,
sizeof buffer, &length);
1328 printf(
"4406 signing time returned OK\n%.*s\n", (
int)length, buffer);
1330 printf(
"4406 signing time not returned (%d) (%s)\n", status,
1336 static void print_sec_label(
1342 char xml_buffer[XML_BUFSIZE];
1345 status = SecLabelInit(
"Example program");
1346 if (status != SECLABEL_E_NOERROR) {
1347 fprintf(stderr,
"SecLabelInit returned error %d\n", status);
1351 status = SecLabelPrint((
const unsigned char *) slab_buffer,
1356 if (status != SECLABEL_E_NOERROR) {
1357 fprintf(stderr,
"SecLabelParse returned error %d\n", status);
1362 printf(
"Got security label:%s\n", xml_buffer);
1366 static void show_certificate (
struct X400msMessage *mp)
1369 struct X400Certificate *cert;
1370 char buffer[BUFSIZ];
1376 fprintf (stderr,
"Error getting MOAC certificate: %s\n",
1382 buffer,
sizeof buffer, &length);
1384 fprintf(stderr,
"Error from CertGetStrParam: %s\n",
1389 "subject DN of originator certificate '%.*s'\n", (
int)length, buffer);
1391 buffer,
sizeof buffer, &length);
1393 fprintf(stderr,
"Error from CertGetStrParam: %s\n",
1398 "issuer DN of originator certificate '%.*s'\n", (
int)length, buffer);
1401 buffer,
sizeof buffer, &length);
1404 fprintf(stderr,
"No ORaddress subject alt. name\n");
1406 fprintf(stderr,
"Error from CertGetStrParam: %s\n",
1411 fprintf(stderr,
"ORaddress subject alt name: '%.*s'\n", (
int)length, buffer);
1417 fprintf(stderr,
"Error from CertGetStrParam: %s\n",
1422 fprintf(stderr,
"ORaddress subject alt name status: %s\n",
1427 static void show_4406_certificate (
struct X400msMessage *mp)
1430 struct X400Certificate *cert;
1431 char buffer[BUFSIZ];
1437 fprintf (stderr,
"Error getting 4406 certificate: %s\n",
1443 buffer,
sizeof buffer, &length);
1445 fprintf(stderr,
"Error from CertGetStrParam: %s\n",
1449 fprintf(stderr,
"subject DN of originator certificate '%.*s'\n",
1450 (
int)length, buffer);
1452 buffer,
sizeof buffer, &length);
1454 fprintf(stderr,
"Error from CertGetStrParam: %s\n",
1458 fprintf(stderr,
"issuer DN of originator certificate '%.*s'\n",
1459 (
int)length, buffer);
1462 buffer,
sizeof buffer, &length);
1465 fprintf(stderr,
"No ORaddress subject alt. name\n");
1467 fprintf(stderr,
"Error from CertGetStrParam: %s\n",
1472 fprintf(stderr,
"ORaddress subject alt name: '%.*s'\n",
1473 (
int)length, buffer);
1479 fprintf(stderr,
"Error from CertGetStrParam: %s\n",
1484 fprintf(stderr,
"ORaddress subject alt name status: %s\n",
1489 static void usage(
void) {
1490 printf(
"usage: %s\n", optstr);
1491 printf(
"\t where:\n");
1492 printf(
"\t -u : Don't prompt to override defaults \n");
1493 printf(
"\t -3 : Use P3 connection \n");
1494 printf(
"\t -7 : Use P7 connection \n");
1495 printf(
"\t -m : OR Address in P7 bind arg \n");
1496 printf(
"\t -d : DN in P7 bind arg \n");
1497 printf(
"\t -p : Presentation Address of P7 Store \n");
1498 printf(
"\t -w : P7 password of P7 user \n");
1499 printf(
"\t -M : OR Address in P3 bind arg \n");
1500 printf(
"\t -D : DN in P3 bind arg \n");
1501 printf(
"\t -P : Presentation Address of P3 server\n");
1502 printf(
"\t -W : P3 password of P3 user \n");
1503 printf(
"\t -o : Originator \n");
1504 printf(
"\t -O : Originator Return Address \n");
1505 printf(
"\t -r : Recipient\n");
1506 printf(
"\t -l : Logline\n");
1507 printf(
"\t -y : Priority (0 - normal, 1 - non-urgent, 2 - urgent \n");
1508 printf(
"\t -C : Content Type (2/22/772/OID) \n");
1509 printf(
"\t -i : Implicit conversion prohibited = TRUE \n");
1510 printf(
"\t -a : Alternate Recipient Prohibited = TRUE \n");
1511 printf(
"\t -q : Content Return Request = TRUE \n");
1512 printf(
"\t -s : Disclosure of Recipient = FALSE \n");
1513 printf(
"\t -A : Recipient Reassignment Prohibited = FALSE \n");
1514 printf(
"\t -v : Conversion with Loss Prohibited = FALSE \n");
1515 printf(
"\t -e : Security Environment (dir with x509 subdir): obsolete, use -Y <p12file>\n");
1516 printf(
"\t -x : DN of X.509 Digital Identity\n");
1517 printf(
"\t -b : Passphrase for private key in PKCS12 file\n");
1518 printf(
"\t -f : Filename to transfer as binary bp\n");
1519 printf(
"\t -Y : Filename of PKCS12 file containing Digital Identity\n");
1520 printf(
"\t -4 : Generate STANAG 4406 PCT Signatures\n");
#define X400_S_LOG_CONFIGURATION_FILE
#define X400_S_CERT_ISSUER_DN
int X400msMsgSend(struct X400msMessage *mp)
Send message object.
#define X400_N_S4406_CERTIFICATE
#define X400_E_SIGN_NO_IDENTITY
int X400msMsgAddAttachment(struct X400msMessage *mp, int type, const char *string, size_t length)
Add attachment to the message.
#define X400_N_S4406_STATUS
int X400msOpen(int type, const char *oraddr, const char *dirname, const char *credentials, const char *pa, int *messages, struct X400msSession **spp)
Open a session to a Message Store (P7) or MTA (P3) in synchronous mode.
#define X400_S_SEC_IDENTITY
int X400msSetStrDefault(struct X400msSession *sp, int paramtype, const char *value, size_t length)
Set a default string parameter value in a session.
#define X400_E_X509_CERT_INVALID
int X400CertGetIntParam(struct X400Certificate *cp, int paramtype, int *valp)
Return a integer-valued parameter from the certificate object.
int X400msMsgGetCert(struct X400msMessage *mp, int certtype, struct X400Certificate **certp)
Get certificate object from message This returns a certificate which was used to sign an object in th...
#define X400_E_X509_VERIFY_FAIL_NO_CERT
#define X400_E_X509_VERIFY_FAIL_NO_PUBKEY
#define X400_S_SECURITY_LABEL
int X400msClose(struct X400msSession *sp)
Close a X400 Session.
int X400msMsgAddIntParam(struct X400msMessage *mp, int paramtype, int value)
Add integer-valued parameter to the message.
int X400msRecipGetIntParam(struct X400Recipient *rp, int paramtype, int *valp)
Return a integer-valued parameter from the recipient object.
#define X400_S_S4406_SIGNING_TIME
int X400msRecipAddIntParam(struct X400Recipient *rp, int paramtype, int value)
Add integer-valued parameter to the message.
#define X400_S_S4406_SECURITY_LABEL
int X400msRecipAddStrParam(struct X400Recipient *rp, int paramtype, const char *value, size_t length)
Add string-valued parameter to the message.
#define X400_S_DIRECTORY_NAME
int X400msMsgGet(struct X400msSession *sp, int number, struct X400msMessage **mpp, int *typep, int *seqp)
Get message object for transfer out from MS or MTA via P3.
#define X400_S_MESSAGE_DELIVERY_TIME
int X400msRecipNew(struct X400msMessage *mp, int type, struct X400Recipient **rpp)
Add new recipient to a message.
#define X400_E_X509_ITEM_INVALID
const char * X400msError(int error)
Obtain a string describing the meaning of the given error code.
#define X400_S_SEC_IDENTITY_DN
#define X400_RECIP_STANDARD
int X400msMsgNew(struct X400msSession *sp, int type, struct X400msMessage **mpp)
Creates new message.
#define X400_S_CONTENT_IDENTIFIER
int X400msWait(struct X400msSession *sp, int seconds, int *count)
Wait for messages to be ready to be read.
#define X400_S_MESSAGE_IDENTIFIER
#define X400_S_SEC_IDENTITY_PASSPHRASE
#define X400_N_REPORT_REQUEST
#define X400_N_MOAC_STATUS
#define X400_S_SUBJECT_IDENTIFIER
int X400msRecipGet(struct X400msMessage *mp, int type, int number, struct X400Recipient **rpp)
Get recipient object from message.
int X400msRecipGetStrParam(struct X400Recipient *rp, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
Return a string-valued parameter from the recipient object.
X400 MA/MS (P3/P7) Interface.
#define X400_E_X509_VERIFY_FAIL_UNSUPPORTED_ALG
#define X400_E_X509_VERIFY_FAIL
#define X400_N_CERT_ORADDRESS_STATUS
int X400msMsgGetIntParam(struct X400msMessage *mp, int paramtype, int *valp)
Return a integer-valued parameter from the message object.
#define X400_RECIP_PRIMARY
#define X400_E_X509_VERIFY_FAIL_INCOMPAT_ALG
#define X400_S_SEC_IDENTITY_FILE
int X400msSetIntDefault(struct X400msSession *sp, int paramtype, int value)
Set a default integer parameter value in a session.
#define X400_N_NON_DELIVERY_DIAGNOSTIC
#define X400_N_NON_DELIVERY_REASON
#define X400_B_RETURN_VERIFICATION_ERRORS
#define X400_N_NOTIFICATION_REQUEST
int X400msTestSecurityEnv(struct X400msSession *sp)
Test the default Security Environment.
#define X400_S_CERT_SUBJECT_DN
int X400msMsgGetStrParam(struct X400msMessage *mp, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
Return a string-valued parameter from the message object.
#define X400_S_SUPPLEMENTARY_INFO
int X400CertGetStrParam(struct X400Certificate *cp, int paramtype, char *buffer, size_t buflen, size_t *paramlenp)
Return a string-valued parameter from the certificate object.
int X400msMsgAddStrParam(struct X400msMessage *mp, int paramtype, const char *value, size_t length)
Add string-valued parameter to the message.
#define X400_S_SEC_TRUSTED_CERTS_DIR
#define X400_B_SEC_GEN_MOAC
#define X400_E_INVALID_ATTR
#define X400_S_OR_ADDRESS
int X400msMsgDelete(struct X400msMessage *mp, int retain)
Delete message object.
#define X400_RECIP_REPORT