S/MIME decoder

I wrote this simple tool because I was sometimes receiving S/MIME signed messages with non-detached signatures that couldn't be easily read in console mail readers (e.g. in pine). Of course I could have used openssl smime command line tool, but it needs some weird parameters to work. So I took this opportunity to write something that uses the OpenSSL library.

It can work either as a filter in which case it doesn't take any argument, or it can take a filename as an argument.

Get the source
smime-decode.c (Colorized)
Compile
$ gcc -o smime-decode smime-decode.c -lcrypto
Get the test file
signed with a detached or embedded signature
Test it
$ ./smime-decode test.txt.detached
This is a funny message, isn't it?
********************
[Detached signature verified]
 
$ ./smime-decode test.txt.embedded
This is a funny message, isn't it?
********************
[Embedded signature verified]
Place for your feedback...
jens
10th October 2009 at 9:21
X509_LOOKUP’ undeclared
At least under OpenSUSE 11.1 add

#include

to avoid errors like

smime-decode.c:20:9: error: #include expects"FILENAME" or
smime-decode.c: In function ‘main’:
smime-decode.c:37: error: ‘X509_LOOKUP’ undeclared (first use in this function)
smime-decode.c:37: error: (Each undeclared identifier is reported only once
smime-decode.c:37: error: for each function it appears in.)
smime-decode.c:37: error: ‘lookup’ undeclared (first use in this function)
smime-decode.c:74: warning: assignment makes pointer from integer without a cast
smime-decode.c:76: error: ‘X509_FILETYPE_DEFAULT’ undeclared (first use in this function)
Aug 12   13:15 email (by asdas)
Oct 21   9:59 oops (by tritt)
Mar 3   13:57 thanks (by fsgd)
Oct 10   9:21 X509_LOOKUP’ undeclared (by jens)
Jun 29   20:57 Re: X509_LOOKUP’ undeclared (by Jaewoo Kim)