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 8417463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:03:27+00:00 2026-06-10T02:03:27+00:00

I have a PKCS7 file, produced by M2Crypto python library, which looks like this:

  • 0

I have a PKCS7 file, produced by M2Crypto python library, which looks like this:

-----BEGIN PKCS7-----
MIIBWAYJKoZIhvcNAQcDo[cut]
-----END PKCS7-----

Is is binary content encripted by a public key.

Now I need to decrypt it in C++, but it seems not to recognize this format. I tried d2i_PKCS7_bio() and SMIME_read_PKCS7(), but I always get errors like:

8957:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1316:
8957:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:380:Type=PKCS7

and similar errors trying by command line like this:

openssl smime -decrypt -inform DER -binary -inkey privkey.pem

EDIT
I found the right command line option:

openssl cms -decrypt -in samplepkcs7.pem  -inkey privkey.pem -inform pem

Now I need to find the corresponding function in C++.

Maybe I’m wrong, but it’s really hard to find documentation on this. Any help would be appreciated.

  • 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-10T02:03:28+00:00Added an answer on June 10, 2026 at 2:03 am

    What you have is a PEM-format object; a DER-format object would look like garbage in a text editor (by virtue of being a binary format). Hence you want PEM_read_PKCS7().

    The OpenSSL documentation is inherently a mess, and it’s very difficult to learn your way around without a guide of some sort. I recommend the O’Reilly Network Security with OpenSSL text; while written for OpenSSL 0.9.6/0.9.7, it’s still an excellent introduction to the library (the API hasn’t changed very much) and will serve as a handy reference.

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

Sidebar

Related Questions

Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
have written this little class, which generates a UUID every time an object of
I have a PHP program that encrypts a PDF file into .xxx file this
I have one .key file from which I generated a .csr file that I
I have pkcs8_rsa_private_key file which generate by openssl from a rsa_private_key.pem file. I need
So, i have this application that creates a zip file with images and stuff
I have test input string (key=value&key=value...) and key (like this D2335A9CA4924D9F914D2B47B450D436) I need to
I have a file with the '.pfx' extension and a password to this certificate.
Have deployed numerous report parts which reference the same view however one of them
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:

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.