MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / TestSaveLoadPrivateKey

Function TestSaveLoadPrivateKey

crypto/kms/privatekeystore_test.go:41–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

39)
40
41func TestSaveLoadPrivateKey(t *testing.T) {
42 Convey("save and load", t, func() {
43 pass := ""
44 privateKeyBytes, _ := hex.DecodeString("f7c0bc718eb0df81e796a11e6f62e23cd2be0a4bdcca30df40d4d915cc3be3ff")
45 privateKey, _ := asymmetric.PrivKeyFromBytes(privateKeyBytes)
46 SavePrivateKey("private.key", privateKey, []byte(pass))
47 pl, _ := LoadPrivateKey("private.key", []byte(pass))
48 So(bytes.Compare(pl.Serialize(), privateKey.Serialize()), ShouldBeZeroValue)
49 So(bytes.Compare(privateKeyBytes, privateKey.Serialize()), ShouldBeZeroValue)
50 publicKeyBytes, _ := hex.DecodeString("02c76216704d797c64c58bc11519fb68582e8e63de7e5b3b2dbbbe8733efe5fd24")
51 publicKey, _ := asymmetric.ParsePubKey(publicKeyBytes)
52 So(pl.PubKey().IsEqual(publicKey), ShouldBeTrue)
53 })
54}
55
56func TestLoadPrivateKey(t *testing.T) {
57 Convey("save and load", t, func() {

Callers

nothing calls this directly

Calls 7

PrivKeyFromBytesFunction · 0.92
ParsePubKeyFunction · 0.92
LoadPrivateKeyFunction · 0.85
PubKeyMethod · 0.80
SavePrivateKeyFunction · 0.70
SerializeMethod · 0.45
IsEqualMethod · 0.45

Tested by

no test coverage detected