aboutsummaryrefslogtreecommitdiff
path: root/lib/util.go
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2017-01-09 10:07:56 +0000
committerGitHub <noreply@github.com>2017-01-09 10:07:56 +0000
commitfc190076448ebf1710910a89b584857cbc89d159 (patch)
treeb82061b8a2af25fbc13f6f9792d42ed7a2ed9d54 /lib/util.go
parenta4b5776500b1250b61c3dafd17e464fdf3f3aae8 (diff)
parent6dfe350cb5eefde3a99374d14c083d1906717ddd (diff)
Merge branch 'master' into opts2
Diffstat (limited to 'lib/util.go')
-rw-r--r--lib/util.go10
1 files changed, 10 insertions, 0 deletions
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])
+}