(t *testing.T)
| 39 | ) |
| 40 | |
| 41 | func 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 | |
| 56 | func TestLoadPrivateKey(t *testing.T) { |
| 57 | Convey("save and load", t, func() { |
nothing calls this directly
no test coverage detected