Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7956017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:51:59+00:00 2026-06-04T03:51:59+00:00

When I try to decrypt an encrypted S/MIME message using CMS in OpenSSL, the

  • 0

When I try to decrypt an encrypted S/MIME message using CMS in OpenSSL, the decrypt method returns me 0 which stands for didn’t succeed.

OpenSSL.org says..

CMS_decrypt() returns either 1 for success or 0 for failure. The error can be obtained from ERR_get_error(3)

When I run this…

out = BIO_new(BIO_s_mem());
if (!out)
        assert(false);

int error = CMS_decrypt(cms, rkey, rcert, out, NULL, 0);
    if (!error) {
    fprintf(stderr, "Error Decrypting Data\n");
    printf("error code: %d\n", ERR_get_error());
    ERR_print_errors_fp(stderr);
    assert(false);
}

… the error variable is 0 which means an error occurred and the error code from ERR_get_error() is also 0. Additionally ERR_print_errors_fp() doesn’t print anything which means there was no error.

The output from the aforementioned code:

Error Decrypting Data
error code: 0
Assertion failed: (false)

Does anyone have a suggestion what’s going wrong here? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:52:01+00:00Added an answer on June 4, 2026 at 3:52 am

    After many weeks of trying different approaches and frustration I ended up using PKCS#7 decrypt of OpenSSL.
    Due CMS is basically based on PKCS#7 it works fine with encryption using CMS and decryption using PKCS7.

    The method I have used is pkcs7_decrypt().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to decrypt data that was originally encrypted with Objective-C in Java. There
I have a problem while trying to decrypt encrypted assertion using SAML 2.0. The
I'm trying to decrypt an encrypted image in Android using this code: public class
I have several strings that were encrypted using OpenSSL. For instance: $ echo original
Try to see which cast is faster (not necessary better): new c++ case or
try { // Code } catch (Exception ex) { Logger.Log(Message, ex); throw; } In
I am trying to write encrypt/decrypt methods for AES 256 CBC encryption using PKCS5Padding
I'm trying to encrypt a text file using Perl and then decrypt it using
I am trying to decrypt in JAVA a string that was encrypted in C#.
I have this function I am using to decrypt values that works fine on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.