From eac296b22a964c059859d5a3cd5e8ac915105fb7 Mon Sep 17 00:00:00 2001 From: Alver Lyu Date: Thu, 13 Dec 2018 11:27:42 +0800 Subject: [PATCH] fix bug in deserializing ed25519 public key --- keypair/key.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keypair/key.go b/keypair/key.go index f44ccc1..dfdaa31 100644 --- a/keypair/key.go +++ b/keypair/key.go @@ -210,7 +210,7 @@ func DeserializePublicKey(data []byte) (PublicKey, error) { if len(data[2:]) < ed25519.PublicKeySize { return nil, errors.New("deserializing public key failed: not enough length for Ed25519 key") } - pk := make([]byte, len(data)-2) + pk := make([]byte, ed25519.PublicKeySize) copy(pk, data[2:]) return ed25519.PublicKey(pk), nil } else {