Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: how to send S/MIME-encrypted emails #11

Open
JayBrown opened this issue Jul 25, 2017 · 1 comment
Open

Question: how to send S/MIME-encrypted emails #11

JayBrown opened this issue Jul 25, 2017 · 1 comment

Comments

@JayBrown
Copy link

There are some automated emails that I want to send encrypted using S/MIME. I have the recipients public key file in .pem format, I have a file, let's say "message.txt", that I want to send him, so I can encrypt it like

openssl smime -encrypt -out message-encrypted -in message.txt public-key.pem

The result looks like:

MIME-Version: 1.0
Content-Disposition: attachment; filename="smime.p7m"
Content-Type: application/pkcs7-mime; smime-type=enveloped-data; name="smime.p7m"
Content-Transfer-Encoding: base64

<ENCRYPTED BODY>

So how do I send this with sendEmail, so that the recipient (who has the corresponding private key) will receive it in a way so that his GUI email client (e.g. Apple Mail) will automatically decrypt the contents?

@JayBrown
Copy link
Author

I managed to send an encrypted email by piping the openssl stdout to sendEmail, and using the -o message-format=raw option. Problem is that Apple Mail says that there was an error decrypting the message, which is weird, because I used the correct public-key.pem, and I have the corresponding secret key in my keychain. Will have to look into this further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant