33 lines
510 B
Go
33 lines
510 B
Go
package utils
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"testing"
|
|
)
|
|
|
|
func TestDecodePrivateKey(t *testing.T) {
|
|
priKeyStr, err := ioutil.ReadFile("../../config/id_ecdsa")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
key, err := DecodePrivateKey(priKeyStr)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
t.Log(key)
|
|
}
|
|
|
|
func TestDecodePublicKey(t *testing.T) {
|
|
priKeyStr, err := ioutil.ReadFile("../../config/id_ecdsa.pub")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
key, err := DecodePublicKey(priKeyStr)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
t.Log(key)
|
|
}
|