lib/sup/crypto.rb in sup-0.10.2 vs lib/sup/crypto.rb in sup-0.11
- old
+ new
@@ -9,10 +9,21 @@
[:sign, "Sign"],
[:sign_and_encrypt, "Sign and encrypt"],
[:encrypt, "Encrypt only"]
)
+ HookManager.register "gpg-args", <<EOS
+Runs before gpg is executed, allowing you to modify the arguments (most
+likely you would want to add something to certain commands, like
+--trust-model always to signing/encrypting a message, but who knows).
+
+Variables:
+args: arguments for running GPG
+
+Return value: the arguments for running GPG
+EOS
+
def initialize
@mutex = Mutex.new
bin = `which gpg`.chomp
@cmd = case bin
@@ -180,9 +191,10 @@
def format_payload payload
payload.to_s.gsub(/(^|[^\r])\n/, "\\1\r\n").gsub(/^MIME-Version: .*\r\n/, "")
end
def run_gpg args, opts={}
+ args = HookManager.run("gpg-args", { :args => args }) || args
cmd = "#{@cmd} #{args}"
if opts[:interactive] && BufferManager.instantiated?
output_fn = Tempfile.new "redwood.output"
output_fn.close
cmd += " > #{output_fn.path} 2> /dev/null"