lib/sup/crypto.rb in sup-0.5 vs lib/sup/crypto.rb in sup-0.6

- old
+ new

@@ -51,11 +51,11 @@ def encrypt from, to, payload, sign=false payload_fn = Tempfile.new "redwood.payload" payload_fn.write format_payload(payload) payload_fn.close - recipient_opts = to.map { |r| "--recipient '#{r}'" }.join(" ") + recipient_opts = to.map { |r| "--recipient '<#{r}>'" }.join(" ") sign_opts = sign ? "--sign --local-user '#{from}'" : "" gpg_output = run_gpg "--output - --armor --encrypt --textmode #{sign_opts} #{recipient_opts} #{payload_fn.path}" raise Error, (gpg_output || "gpg command failed: #{cmd}") unless $?.success? encrypted_payload = RMail::Message.new @@ -148,9 +148,11 @@ def cant_find_binary ["Can't find gpg binary in path."] end + ## here's where we munge rmail output into the format that signed/encrypted + ## PGP/GPG messages should be def format_payload payload payload.to_s.gsub(/(^|[^\r])\n/, "\\1\r\n").gsub(/^MIME-Version: .*\r\n/, "") end def run_gpg args