aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorGibheer <gibheer@gmail.com>2015-01-16 11:23:14 +0100
committerGibheer <gibheer@gmail.com>2015-01-16 11:23:14 +0100
commit68167a5891e3680331a44ab20fdb198e0447cf88 (patch)
treee1d07dd2b4dbcb935b2a00c5f3c10c752781434e /main.go
parent43384bab59112965e171d217f9b60e00c20659a0 (diff)
add signing and verifying of messages
With this it is possible to sign a message with a private key and verify it with a public key. The only problem is, that it is currently not compatible with openssl yet.
Diffstat (limited to 'main.go')
-rw-r--r--main.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/main.go b/main.go
index dac1ee4..73ea1b2 100644
--- a/main.go
+++ b/main.go
@@ -28,10 +28,11 @@ func main() {
case "create-private": create_private_key()
case "create-cert-sign": create_sign_request()
case "create-public": create_public_key()
- case "help": print_modules()
- case "info": info_on_file()
- case "sign-request": sign_request()
- case "sign-input": sign_input()
+ case "help": print_modules()
+ case "info": info_on_file()
+ case "sign-request": sign_request()
+ case "sign-input": sign_input()
+ case "verify-signature": verify_signature()
default: crash_with_help(1, "Command not supported!")
}
}
@@ -43,9 +44,10 @@ func sign_request() {}
// open stream for given path
func open_output_stream(path string) (io.WriteCloser, error) {
- if path == "STDOUT" {
- return os.Stdout, nil
- } else {
+ switch path {
+ case "STDOUT": return os.Stdout, nil
+ case "STDERR": return os.Stderr, nil
+ default:
var err error
output_stream, err := os.OpenFile(path, os.O_WRONLY | os.O_CREATE | os.O_TRUNC, 0600)
if err != nil {
@@ -65,6 +67,8 @@ where 'command' is one of:
help show this help
info get info on a file
sign sign a certificate request
+ sign-input sign a message with a private key
+ verify-signature verify a signature
`, filepath.Base(os.Args[0]))
fmt.Println()
}