6

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.

Perception
  • 79,279
  • 19
  • 185
  • 195
Ryan Horrisberger
  • 955
  • 11
  • 16
  • 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} – Ryan Horrisberger Jun 30 '10 at 19:43
  • I can't believe the amount of (working) code examples I get when I google "ruby smime"... That's... impressive! – Romain Jan 27 '11 at 10:53
  • here's a stack overflow with someone who says they figured out how to do it. I don't understand what's going on enough to know how far this gets you: http://stackoverflow.com/questions/11159478/openssl-smime-in-ruby-rails – jrochkind Aug 22 '12 at 02:20
  • Please answer your own question and mark the answer as accepted. – Patrick Oscity Apr 03 '13 at 19:16
  • @padde I didn't have enough reputation to do that when I first posted the question, but I do now--thanks for the suggestion. – Ryan Horrisberger Apr 08 '13 at 20:23

1 Answers1

1

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}

Ryan Horrisberger
  • 955
  • 11
  • 16