VirtualBox

source: vbox/trunk/src/libs/openssl-3.4.1/demos/cms/cms_uncomp.c

Last change on this file was 109052, checked in by vboxsync, 3 weeks ago

openssl-3.4.1: Applied our changes, regenerated files, added missing files and functions. This time with a three way merge. ​bugref:10890

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.2 KB
Line 
1/*
2 * Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10/* Simple S/MIME uncompression example */
11#include <openssl/pem.h>
12#include <openssl/cms.h>
13#include <openssl/err.h>
14
15int main(int argc, char **argv)
16{
17 BIO *in = NULL, *out = NULL;
18 CMS_ContentInfo *cms = NULL;
19 int ret = EXIT_FAILURE;
20
21 OpenSSL_add_all_algorithms();
22 ERR_load_crypto_strings();
23
24 /* Open compressed content */
25
26 in = BIO_new_file("smcomp.txt", "r");
27
28 if (!in)
29 goto err;
30
31 /* Sign content */
32 cms = SMIME_read_CMS(in, NULL);
33
34 if (!cms)
35 goto err;
36
37 out = BIO_new_file("smuncomp.txt", "w");
38 if (!out)
39 goto err;
40
41 /* Uncompress S/MIME message */
42 if (!CMS_uncompress(cms, out, NULL, 0))
43 goto err;
44
45 ret = EXIT_SUCCESS;
46 err:
47 if (ret != EXIT_SUCCESS) {
48 fprintf(stderr, "Error Uncompressing Data\n");
49 ERR_print_errors_fp(stderr);
50 }
51
52 CMS_ContentInfo_free(cms);
53 BIO_free(in);
54 BIO_free(out);
55 return ret;
56}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette