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

Function TestPublicKey_MarshalBinary

crypto/asymmetric/keypair_test.go:144–164  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

142}
143
144func TestPublicKey_MarshalBinary(t *testing.T) {
145 Convey("marshal unmarshal public key", t, func() {
146 _, publicKey, _ := GenSecp256k1KeyPair()
147 publicKey2 := new(PublicKey)
148 buf, _ := publicKey.MarshalBinary()
149 publicKey2.UnmarshalBinary(buf)
150
151 So(publicKey.IsEqual(publicKey2), ShouldBeTrue)
152
153 publicKey3 := new(PublicKey)
154 publicKey3.UnmarshalBinary(buf)
155
156 buf1, _ := publicKey.MarshalHash()
157 buf2, _ := publicKey2.MarshalHash()
158 buf3, _ := publicKey3.MarshalHash()
159
160 So(buf1, ShouldResemble, buf2)
161 So(buf1, ShouldResemble, buf3)
162 So(publicKey.Msgsize(), ShouldEqual, publicKey2.Msgsize())
163 })
164}
165
166func TestPrivateKey_Serialize(t *testing.T) {
167 Convey("marshal unmarshal private key", t, func() {

Callers

nothing calls this directly

Calls 6

GenSecp256k1KeyPairFunction · 0.85
MarshalHashMethod · 0.65
MsgsizeMethod · 0.65
MarshalBinaryMethod · 0.45
UnmarshalBinaryMethod · 0.45
IsEqualMethod · 0.45

Tested by

no test coverage detected