mirror of
https://github.com/libp2p/go-openssl.git
synced 2026-08-22 15:23:28 +08:00
add EC key generation.
This commit is contained in:
15
key_test.go
15
key_test.go
@@ -158,6 +158,21 @@ func TestGenerate(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateEC(t *testing.T) {
|
||||
key, err := GenerateECKey(Prime256v1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err = key.MarshalPKIXPublicKeyPEM()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err = key.MarshalPKCS1PrivateKeyPEM()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSign(t *testing.T) {
|
||||
key, _ := GenerateRSAKey(1024)
|
||||
data := []byte("the quick brown fox jumps over the lazy dog")
|
||||
|
||||
Reference in New Issue
Block a user