1
1
A private web application needs to receive encrypted email from perhaps 20 known users. How can I use OpenSSL to generate a valid encryption certificate that Outlook users can import and use to encrypt emails which can be decrypted after being received by an email address connected to my app?
Towards this end, I started using the code from @logicalscope's answer to this other posting, which I will summarize here as follows:
$ openssl genrsa -aes128 -out email.key 2048
$ openssl req -new -key email.key -out email.csr -config email.cnf
$ openssl x509 -req -days 365 -in email.csr -CA ca.crt -CAkey ca.key -set_serial 10 -out email.crt
$ openssl pkcs12 -export -in email.crt -inkey email.key -out email.pfx
Where email.cnf
is created in advance of the preceding steps as:
[ req ]
default_bits = 2048
distinguished_name = req_distinguished_name
prompt = no
[ req_distinguished_name ]
C = {Country}
ST = {Provice/State}
L = {City}
O = {Org}
OU = {Org Unit}
CN = user@domain.com
emailAddress = user@domain.com
The problem is that the code above does not know where to look for ca.crt
. Therefore, the line openssl x509 -req -days 365 -in email.csr -CA ca.crt -CAkey ca.key -set_serial 10 -out email.crt
results in the following:
Signature ok
subject=/C=US/ST=CA/L=MyCity/O=MyOrganization/OU=MyUnit/CN=me@serverdomain.com/emailAddress=me@serverdomain.com
Error opening CA Certificate ca.crt
140570916620192:error:02001002:system library:fopen:No such file or directory:bss_file.c:398:fopen('ca.crt','r')
140570916620192:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:400:
unable to load certificate
How can I generate a valid ca.crt
in a way that will enable Outlook users to use email.pfx
to encrypt emails that my app can decrypt upon receipt? Do I need to purchase a certificate? This is just for a development server at the moment. It would be nice to get something to work that is free. For example, Thunderbird users are able to send emails encrypted with a GPG key that my app is able to decrypt.
My devbox is running Windows 7 and Outlook 2010.
Thank you and +1 for taking the time to look into this old question. I cannot verify the answer right now. But I have bookmarked this question so that I can refer to your answer when i am ready to revisit this. – CodeMed – 2015-10-04T12:38:54.803