| /* Simple S/MIME compress example */ |
| int main(int argc, char **argv) |
| BIO *in = NULL, *out = NULL; |
| CMS_ContentInfo *cms = NULL; |
| * On OpenSSL 1.0.0+ only: |
| * for streaming set CMS_STREAM |
| OpenSSL_add_all_algorithms(); |
| ERR_load_crypto_strings(); |
| /* Open content being compressed */ |
| in = BIO_new_file("comp.txt", "r"); |
| cms = CMS_compress(in, NID_zlib_compression, flags); |
| out = BIO_new_file("smcomp.txt", "w"); |
| /* Write out S/MIME message */ |
| if (!SMIME_write_CMS(out, cms, in, flags)) |
| fprintf(stderr, "Error Compressing Data\n"); |
| ERR_print_errors_fp(stderr); |
| CMS_ContentInfo_free(cms); |