Skip to content

Instantly share code, notes, and snippets.

@psifertex
Created April 30, 2015 14:43
Show Gist options
  • Save psifertex/2a85db3e8ab32e7b2eef to your computer and use it in GitHub Desktop.
Save psifertex/2a85db3e8ab32e7b2eef to your computer and use it in GitHub Desktop.
#!/bin/bash
tempfoo=`basename $0`
TMPFILE=`mktemp -d -q /tmp/${tempfoo}.XXXXXX`
cp $1 $TMPFILE
cd $TMPFILE
filename=`tnef -t -f $1|awk '{print $1}'`
tnef -C . -f $1
ls -l $filename
security cms -D -i $filename|tail +4|base64 -D > test.dat
openssl smime -verify -inform der -in test.dat -out test.txt
cd -
mv $TMPFILE/test.txt $1.eml
ls -l $1.eml
open $1.eml
rm -rf $TMPFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment