2022-01-15 22:19:29 +01:00
|
|
|
package meowlib
|
2021-10-18 21:05:44 +02:00
|
|
|
|
|
|
|
import (
|
2022-01-15 22:19:29 +01:00
|
|
|
"encoding/base64"
|
2021-10-18 21:05:44 +02:00
|
|
|
"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())
|
2022-01-15 22:19:29 +01:00
|
|
|
Armpubkey, _ := key.GetArmoredPublicKey()
|
|
|
|
pubkey := base64.StdEncoding.EncodeToString([]byte(Armpubkey))
|
2021-10-18 21:05:44 +02:00
|
|
|
if kp.Public != pubkey {
|
|
|
|
log.Fatal("error in public key")
|
|
|
|
}
|
|
|
|
}
|