From a33bd14386ea4b4761dbcb74502250b7a127c79a Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 25 Dec 2013 00:12:31 +0400 Subject: [PATCH] Gpg signing. --- utils/gpg.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 utils/gpg.go diff --git a/utils/gpg.go b/utils/gpg.go new file mode 100644 index 00000000..73a8bd66 --- /dev/null +++ b/utils/gpg.go @@ -0,0 +1,20 @@ +package utils + +import ( + "fmt" + "os/exec" + "strings" +) + +// GpgDetachedSign signs file with detached signature in ASCII format +func GpgDetachedSign(source string, destination string) error { + fmt.Printf("v = %#v\n", strings.Join([]string{"gpg", "-o", destination, "--armor", "--detach-sign", source}, " ")) + cmd := exec.Command("gpg", "-o", destination, "--armor", "--yes", "--detach-sign", source) + return cmd.Run() +} + +// GpgClearSign clear-signs the file +func GpgClearSign(source string, destination string) error { + cmd := exec.Command("gpg", "-o", destination, "--yes", "--clearsign", source) + return cmd.Run() +}