Skip to content

Commit

Permalink
verify EdDSA key on creation step (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg authored Aug 19, 2020
1 parent 8132fd4 commit 4216c3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions algo_eddsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

// NewSignerEdDSA returns a new ed25519-based signer.
func NewSignerEdDSA(key ed25519.PrivateKey) (Signer, error) {
if len(key) == 0 {
if len(key) == 0 || len(key) != ed25519.PrivateKeySize {
return nil, ErrInvalidKey
}
return &edDSAAlg{
Expand All @@ -17,7 +17,7 @@ func NewSignerEdDSA(key ed25519.PrivateKey) (Signer, error) {

// NewVerifierEdDSA returns a new ed25519-based verifier.
func NewVerifierEdDSA(key ed25519.PublicKey) (Verifier, error) {
if len(key) == 0 {
if len(key) == 0 || len(key) != ed25519.PublicKeySize {
return nil, ErrInvalidKey
}
return &edDSAAlg{
Expand Down

0 comments on commit 4216c3a

Please sign in to comment.