meowlib/asymcrypt_test.go
2022-01-15 22:19:29 +01:00

28 lines
522 B
Go

package meowlib
import (
"encoding/base64"
"fmt"
"log"
"testing"
)
func TestNewKeyPair(t *testing.T) {
kp := NewKeyPair()
fmt.Println(kp.Public)
fmt.Println(kp.Private)
}
func TestGetKey(t *testing.T) {
kp := NewKeyPair()
// fmt.Println(kp.Public)
// fmt.Println(kp.Private)
key := kp.GetCryptoKeyObject()
// fmt.Println(key.Armor())
Armpubkey, _ := key.GetArmoredPublicKey()
pubkey := base64.StdEncoding.EncodeToString([]byte(Armpubkey))
if kp.Public != pubkey {
log.Fatal("error in public key")
}
}