Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Digitally sign email in Ruby with S/MIME

Is there a way in Ruby to digitally sign email messages with S/MIME? Our group uses PKI and our users are conditioned to expect digital signatures for important messages.

I know I can invoke the openssl command line tool:

openssl smime -sign -signer $CERT_FILE -passin pass:$CERT_PASS
  -in $UNSIGNED_MAIL -out $SIGNED_MAIL -certfile $CERT_CA_FILE
  -from 'your ' -to 'recipients <email@address>'
  -subject 'The Subject'

but I am hoping to utilize a Ruby solution.

like image 715
Ryan Horrisberger Avatar asked Apr 07 '10 04:04

Ryan Horrisberger


Video Answer


1 Answers

I ended up using the above solution, but for those in a similar situation, you have to convert the PKI key (in .p12 file format) first: openssl pkcs12 -in #{@cert_file} -passin pass:#{@pass_phrase} -passout pass:#{@pass_phrase} -out #{out_file}

like image 155
Ryan Horrisberger Avatar answered Sep 30 '22 16:09

Ryan Horrisberger