1 #define _XOPEN_SOURCE 500
12 int main(int argc
, char **argv
) {
13 struct isds_ctx
*ctx
= NULL
;
16 setlocale(LC_ALL
, "");
18 if (argc
!= 2 || !argv
[1] || !*argv
[1]) {
19 printf("Usage: %s FILE_WITH_SIGNED_SEND_MESSAGE\n", basename(argv
[0]));
25 printf("isds_init() failed: %s\n", isds_strerror(err
));
29 isds_set_logging(ILF_ALL
& ~ILF_HTTP
, ILL_ALL
);
31 ctx
= isds_ctx_create();
33 printf("isds_ctx_create() failed");
39 /* Load CMS signed sent message */
40 struct isds_message
*message
= NULL
;
45 if (mmap_file(argv
[1], &fd
, &buffer
, &length
)) {
46 fprintf(stderr
, "Could not map file with message");
52 printf("Loading CMS signed sent message\n");
53 err
= isds_load_message(ctx
, RAWTYPE_CMS_SIGNED_OUTGOING_MESSAGE
,
54 buffer
, length
, &message
, BUFFER_DONT_STORE
);
56 printf("isds_load_message() failed: %s: %s\n",
57 isds_strerror(err
), isds_long_message(ctx
));
59 printf("isds_load_message() succeeded:\n");
60 print_message(message
);
63 isds_message_free(&message
);
64 munmap_file(fd
, buffer
, length
);
69 err
= isds_ctx_free(&ctx
);
71 printf("isds_ctx_free() failed: %s\n", isds_strerror(err
));
77 printf("isds_cleanup() failed: %s\n", isds_strerror(err
));