Skip to content

Commit

Permalink
convert key tests to tabular tests
Browse files Browse the repository at this point in the history
Signed-off-by: qmuntal <qmuntaldiaz@microsoft.com>
  • Loading branch information
qmuntal committed Jul 10, 2023
1 parent c768d2b commit 16a0075
Show file tree
Hide file tree
Showing 2 changed files with 688 additions and 371 deletions.
10 changes: 8 additions & 2 deletions key.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ func NewOKPKey(alg Algorithm, x, d []byte) (*Key, error) {
X: x,
D: d,
}
return key, key.validate(KeyOpInvalid)
if err := key.validate(KeyOpInvalid); err != nil {
return nil, err
}
return key, nil
}

// NewEC2Key returns a Key created using the provided elliptic curve key
Expand All @@ -303,7 +306,10 @@ func NewEC2Key(alg Algorithm, x, y, d []byte) (*Key, error) {
Y: y,
D: d,
}
return key, key.validate(KeyOpInvalid)
if err := key.validate(KeyOpInvalid); err != nil {
return nil, err
}
return key, nil
}

// NewSymmetricKey returns a Key created using the provided Symmetric key
Expand Down
Loading

0 comments on commit 16a0075

Please sign in to comment.