From 9e9a7d50970f1424245d88169de82988fd57e112 Mon Sep 17 00:00:00 2001 From: Niall Sheridan Date: Thu, 5 Jan 2017 23:28:26 +0000 Subject: Move GetPublicKey to the shared `lib` package --- lib/util.go | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lib/util.go (limited to 'lib/util.go') diff --git a/lib/util.go b/lib/util.go new file mode 100644 index 0000000..b1c7b87 --- /dev/null +++ b/lib/util.go @@ -0,0 +1,10 @@ +package lib + +import "golang.org/x/crypto/ssh" + +// GetPublicKey marshals a ssh certificate to a string. +func GetPublicKey(pub ssh.PublicKey) string { + marshaled := ssh.MarshalAuthorizedKey(pub) + // Strip trailing newline + return string(marshaled[:len(marshaled)-1]) +} -- cgit v1.2.3