From e8ff7ffe8e8c25195c64950b61c6c5754bbcd3ba Mon Sep 17 00:00:00 2001 From: Niall Sheridan Date: Sun, 19 Feb 2017 00:25:42 +0000 Subject: Add grpc signer --- lib/util.go | 4 ++-- lib/util_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/util.go b/lib/util.go index b1c7b87..ca88f3f 100644 --- a/lib/util.go +++ b/lib/util.go @@ -3,8 +3,8 @@ package lib import "golang.org/x/crypto/ssh" // GetPublicKey marshals a ssh certificate to a string. -func GetPublicKey(pub ssh.PublicKey) string { +func GetPublicKey(pub ssh.PublicKey) []byte { marshaled := ssh.MarshalAuthorizedKey(pub) // Strip trailing newline - return string(marshaled[:len(marshaled)-1]) + return marshaled[:len(marshaled)-1] } diff --git a/lib/util_test.go b/lib/util_test.go index 9e89297..b1f18a8 100644 --- a/lib/util_test.go +++ b/lib/util_test.go @@ -1,6 +1,7 @@ package lib import ( + "reflect" "testing" "github.com/nsheridan/cashier/testdata" @@ -10,7 +11,7 @@ import ( func TestGetPublicKey(t *testing.T) { t.Parallel() c, _, _, _, _ := ssh.ParseAuthorizedKey(testdata.Cert) - if GetPublicKey(c.(*ssh.Certificate)) != string(testdata.Cert) { + if !reflect.DeepEqual(GetPublicKey(c.(*ssh.Certificate)), testdata.Cert) { t.Fail() } } -- cgit v1.2.3