mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2024-12-26 23:30:27 +08:00
Add test for unknown elliptic curves
This commit is contained in:
parent
23da4bd6da
commit
c7c0a1cdf0
@ -145,3 +145,15 @@ func (pk testkey) Raw() ([]byte, error) {
|
|||||||
func (pk testkey) Equals(k Key) bool {
|
func (pk testkey) Equals(k Key) bool {
|
||||||
return KeyEqual(pk, k)
|
return KeyEqual(pk, k)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestUnknownCurveErrors(t *testing.T) {
|
||||||
|
_, _, err := GenerateEKeyPair("P-256")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
_, _, err = GenerateEKeyPair("error-please")
|
||||||
|
if err == nil {
|
||||||
|
t.Fatal("expected invalid key type to error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user