Skip to content

Commit

Permalink
modify ed25519 key length checking in deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
AlverLyu committed Dec 13, 2018
1 parent eac296b commit 0c2462b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions keypair/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ func DeserializePublicKey(data []byte) (PublicKey, error) {

case PK_EDDSA:
if data[1] == ED25519 {
if len(data[2:]) < ed25519.PublicKeySize {
return nil, errors.New("deserializing public key failed: not enough length for Ed25519 key")
if len(data[2:]) != ed25519.PublicKeySize {
return nil, errors.New("deserializing public key failed: invalid length for Ed25519 public key")
}
pk := make([]byte, ed25519.PublicKeySize)
copy(pk, data[2:])
Expand Down

0 comments on commit 0c2462b

Please sign in to comment.