Ryan Horrisberger
Ryan Horrisberger

Reputation: 965

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.

Upvotes: 6

Views: 1770

Answers (1)

Ryan Horrisberger
Ryan Horrisberger

Reputation: 965

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}

Upvotes: 1

Related Questions