I want to be able to send automated encrypted email from Linux to Microsoft Outlook user’s email. I know little about S/MIME but I have managed to accomplish sending encrypted text emails using this Linux command line:
openssl smime -encrypt -aes256 -in email_contents.txt -text -subject "Encrypted email test" -to username@domain username.pem | sendmail username@domain
In the above username.pem is the public encryption key previously extracted from a user’s PIV (Personal Identity Verification) card, also known as a CAC card or Smart card. The email recipient, in this case username@domain, can then read that encrypted email in Outlook using their PIV card which has the matching private key. No one else can read the email because they don’t have the PIV card with the private key. What they read in the decrypted email is what was in the text file email_contents.txt. It all works. So far so good.
What I want to do but in my inexperience have not been able to figure out how to do is send a binary file, such as an Excel spreadsheet, in an encrypted mail. Ideally this would be as an attachment (encrypted) to the encrypted email that also has text content explaining what the attachment is about. I know how to have such an attachment to a “plain MIME” non-encrypted email but I need to know how to do it all encrypted, if that is possible. All from the command line so it can be automated.
I have done quite a bit of Google searching (where I figured out how to email an encrypted text message as seen above) but so far can’t figure out emailing an encrypted binary file or encrypted binary attachment.
Anyone know how to do this?
0 Answers