Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Error reading S/MIME message with openssl

by Anonymous Monk
on Oct 05, 2019 at 08:20 UTC ( #11107083=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

Customer is trying to decrypt the mailfile and write another file with decrypted email data. but getting empty file. below command giving me below error, what could be the possible reasons. this seems to have happened after customer updated there certificate before that same command seemed to be working fine.

#command my $system_output = system("$OPENSSL smime -decrypt -in $mailfile -rec +ip $RECIP_CERT -inkey $RECIP_KEY -passin pass:$RECIP_PASSWORD > ${ma +ilfile}.txt"); &DebugIncoming("SYSTEM OUTPUT : $system_output"); &DebugIncoming("FILE SIZE :". -s ${mailfile}.txt); ##it returning empt +y file.
#Error in detail Error reading S/MIME message 2992:error:0D0D40CD:asn1 encoding routines:SMIME_read_ASN1:invalid mim +e type:crypto/asn1/asn_mime.c:460:type: multipart/alternative
Thank you.

Replies are listed 'Best First'.
Re: Error reading S/MIME message with openssl
by Corion (Patriarch) on Oct 05, 2019 at 09:37 UTC

    Does the error occur without using Perl as well?

    What is the output if you run the following command on the shell (with the variables replaced by the values in your Perl program):

    $OPENSSL smime -decrypt -in $mailfile -recip $RECIP_CERT -inkey $RECIP +_KEY -passin pass:$RECIP_PASSWORD

    If you get the same output there, the problem is with $OPENSSL or with the client input and has nothing to do with Perl.

Re: Error reading S/MIME message with openssl
by jcb (Parson) on Oct 05, 2019 at 19:43 UTC

    What has changed in the certificate? Does the new certificate specify different algorithms, perhaps implicitly?

    That is an OpenSSL error, complaining either that it does not like multipart/alternative or that the MIME type crypto/asn1 is not recognized. Perhaps you need a newer version of OpenSSL?

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11107083]
Approved by davies
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2022-05-27 16:50 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (97 votes). Check out past polls.