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

Function TestGenECDHSharedSecret

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

Source from the content-addressed store, hash-verified

55}
56
57func TestGenECDHSharedSecret(t *testing.T) {
58 privateKey1, publicKey1, _ := GenSecp256k1KeyPair()
59 privateKey2, publicKey2, _ := GenSecp256k1KeyPair()
60 shared1 := GenECDHSharedSecret(privateKey1, publicKey2)
61 shared2 := GenECDHSharedSecret(privateKey2, publicKey1)
62 if len(shared1) <= 0 {
63 t.Errorf("shared length should not be %d", len(shared1))
64 }
65
66 for i, b := range shared1 {
67 if b != shared2[i] {
68 t.Error("shared1 and shared2 should be equel")
69 }
70 }
71 //t.Log(shared1)
72}
73
74func TestGetPubKeyNonce(t *testing.T) {
75 Convey("translate key error", t, func() {

Callers

nothing calls this directly

Calls 4

GenSecp256k1KeyPairFunction · 0.85
GenECDHSharedSecretFunction · 0.85
ErrorfMethod · 0.80
ErrorMethod · 0.80

Tested by

no test coverage detected