28 lines
522 B
Go
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")
|
|
}
|
|
}
|