- {
- BIO *in = NULL, *out = NULL, *tbio = NULL;
- X509 *scert = NULL;
- EVP_PKEY *skey = NULL;
- PKCS7 *p7 = NULL;
- int ret = 1;
-
- /* For simple S/MIME signing use PKCS7_DETACHED.
- * On OpenSSL 0.9.9 only:
- * for streaming detached set PKCS7_DETACHED|PKCS7_STREAM
- * for streaming non-detached set PKCS7_STREAM
- */
- int flags = PKCS7_DETACHED|PKCS7_STREAM;
-
- OpenSSL_add_all_algorithms();
- ERR_load_crypto_strings();
-
- /* Read in signer certificate and private key */
- tbio = BIO_new_file("signer.pem", "r");