Skip to content
Snippets Groups Projects
Commit 7ce505e9 authored by Jonah Husson's avatar Jonah Husson
Browse files

More rekey fixes

parent e51ac662
Branches
Tags
3 merge requests!510Release,!207WIP: Client Restructure,!203Symmetric broadcast
...@@ -26,7 +26,7 @@ import ( ...@@ -26,7 +26,7 @@ import (
"testing" "testing"
) )
// Smoke test for handleTrigger // Smoke test for handleConfirm
func TestHandleConfirm(t *testing.T) { func TestHandleConfirm(t *testing.T) {
grp := getGroup() grp := getGroup()
rng := fastRNG.NewStreamGenerator(1000, 10, csprng.NewSystemRNG) rng := fastRNG.NewStreamGenerator(1000, 10, csprng.NewSystemRNG)
......
...@@ -15,16 +15,12 @@ import ( ...@@ -15,16 +15,12 @@ import (
"gitlab.com/elixxir/client/e2e/ratchet" "gitlab.com/elixxir/client/e2e/ratchet"
"gitlab.com/elixxir/client/e2e/ratchet/partner/session" "gitlab.com/elixxir/client/e2e/ratchet/partner/session"
"gitlab.com/elixxir/client/e2e/receive" "gitlab.com/elixxir/client/e2e/receive"
"gitlab.com/elixxir/client/network"
"gitlab.com/elixxir/client/storage"
util "gitlab.com/elixxir/client/storage/utility" util "gitlab.com/elixxir/client/storage/utility"
"gitlab.com/elixxir/client/storage/versioned" "gitlab.com/elixxir/client/storage/versioned"
"gitlab.com/elixxir/comms/client"
dh "gitlab.com/elixxir/crypto/diffieHellman" dh "gitlab.com/elixxir/crypto/diffieHellman"
"gitlab.com/elixxir/crypto/fastRNG" "gitlab.com/elixxir/crypto/fastRNG"
"gitlab.com/elixxir/ekv" "gitlab.com/elixxir/ekv"
"gitlab.com/xx_network/crypto/csprng" "gitlab.com/xx_network/crypto/csprng"
"gitlab.com/xx_network/crypto/signature/rsa"
"gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/netTime" "gitlab.com/xx_network/primitives/netTime"
"math/rand" "math/rand"
...@@ -32,7 +28,6 @@ import ( ...@@ -32,7 +28,6 @@ import (
"time" "time"
) )
var exchangeAliceId, exchangeBobId *id.ID
var r *ratchet.Ratchet var r *ratchet.Ratchet
var myID, bobID *id.ID var myID, bobID *id.ID
var aliceSwitchboard = receive.New() var aliceSwitchboard = receive.New()
...@@ -107,33 +102,11 @@ func TestFullExchange(t *testing.T) { ...@@ -107,33 +102,11 @@ func TestFullExchange(t *testing.T) {
// Start the listeners for alice and bob // Start the listeners for alice and bob
rekeyParams := GetDefaultParams() rekeyParams := GetDefaultParams()
rekeyParams.RoundTimeout = 1 * time.Second rekeyParams.RoundTimeout = 1 * time.Second
aliceRSAKey, err := rsa.GenerateKey(csprng.NewSystemRNG(), 256) _, err = Start(aliceSwitchboard, r, testSendE2E, &mockNetManager{}, grp, rekeyParams)
bobRSAKey, err := rsa.GenerateKey(csprng.NewSystemRNG(), 256)
aliceComms, err := client.NewClientComms(myID, rsa.CreatePublicKeyPem(aliceRSAKey.GetPublic()), rsa.CreatePrivateKeyPem(aliceRSAKey), nil)
if err != nil {
t.Errorf("Failed to start alice comms: %+v", err)
}
fmt.Println("hi")
aliceManager, err := network.NewManager(network.GetDefaultParams(), aliceComms, storage.InitTestingSession(t), getNDF(t), rng, nil)
if err != nil {
t.Errorf("Failed to start alice manager: %+v", err)
}
fmt.Println("hello")
bobComms, err := client.NewClientComms(myID, rsa.CreatePublicKeyPem(bobRSAKey.GetPublic()), rsa.CreatePrivateKeyPem(bobRSAKey), nil)
if err != nil {
t.Errorf("Failed to start bob comms: %+v", err)
}
fmt.Println("hey")
bobManager, err := network.NewManager(network.GetDefaultParams(), bobComms, storage.InitTestingSession(t), getNDF(t), rng, nil)
if err != nil {
t.Errorf("Failed to start bob manager: %+v", err)
}
fmt.Println("0")
_, err = Start(aliceSwitchboard, r, testSendE2E, aliceManager, grp, rekeyParams)
if err != nil { if err != nil {
t.Errorf("Failed to Start alice: %+v", err) t.Errorf("Failed to Start alice: %+v", err)
} }
_, err = Start(bobSwitchboard, r, testSendE2E, bobManager, grp, rekeyParams) _, err = Start(bobSwitchboard, r, testSendE2E, &mockNetManager{}, grp, rekeyParams)
if err != nil { if err != nil {
t.Errorf("Failed to Start bob: %+v", err) t.Errorf("Failed to Start bob: %+v", err)
} }
...@@ -152,13 +125,13 @@ func TestFullExchange(t *testing.T) { ...@@ -152,13 +125,13 @@ func TestFullExchange(t *testing.T) {
triggerMsg := receive.Message{ triggerMsg := receive.Message{
Payload: rekeyTrigger, Payload: rekeyTrigger,
MessageType: catalog.KeyExchangeTrigger, MessageType: catalog.KeyExchangeTrigger,
Sender: exchangeBobId, Sender: bobID,
Timestamp: netTime.Now(), Timestamp: netTime.Now(),
Encrypted: true, Encrypted: true,
} }
// get Alice's manager for reception from Bob // get Alice's manager for reception from Bob
receivedManager, err := r.GetPartner(exchangeBobId, myID) receivedManager, err := r.GetPartner(bobID, myID)
if err != nil { if err != nil {
t.Errorf("Failed to get bob's manager: %v", err) t.Errorf("Failed to get bob's manager: %v", err)
} }
......
...@@ -7,113 +7,148 @@ ...@@ -7,113 +7,148 @@
package rekey package rekey
import (
"github.com/cloudflare/circl/dh/sidh"
"github.com/golang/protobuf/proto"
"gitlab.com/elixxir/client/catalog"
"gitlab.com/elixxir/client/e2e/ratchet"
session2 "gitlab.com/elixxir/client/e2e/ratchet/partner/session"
"gitlab.com/elixxir/client/e2e/receive"
"gitlab.com/elixxir/client/stoppable"
util "gitlab.com/elixxir/client/storage/utility"
"gitlab.com/elixxir/client/storage/versioned"
dh "gitlab.com/elixxir/crypto/diffieHellman"
"gitlab.com/elixxir/crypto/fastRNG"
"gitlab.com/elixxir/ekv"
"gitlab.com/xx_network/crypto/csprng"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/netTime"
"math/rand"
"testing"
"time"
)
// Smoke test for handleTrigger // Smoke test for handleTrigger
//func TestHandleTrigger(t *testing.T) { func TestHandleTrigger(t *testing.T) {
// // Generate alice and bob's session grp := getGroup()
// aliceSession, aliceManager, err := InitTestingContextGeneric(t) rng := fastRNG.NewStreamGenerator(1000, 10, csprng.NewSystemRNG)
// if err != nil { // Generate alice and bob's session
// t.Fatalf("Failed to create alice session: %v", err) // Pull the keys for Alice and Bob
// } bobPrivKey := dh.GeneratePrivateKey(dh.DefaultPrivateKeyLength,
// bobSession, _, err := InitTestingContextGeneric(t) grp, rng.GetStream())
// if err != nil { bobPubKey := dh.GeneratePublicKey(bobPrivKey, grp)
// t.Fatalf("Failed to create bob session: %v", err) alicePrivKey := dh.GeneratePrivateKey(dh.DefaultPrivateKeyLength, grp, rng.GetStream())
// } alicePubKey := dh.GeneratePublicKey(alicePrivKey, grp)
// // Pull the keys for Alice and Bob
// alicePrivKey := aliceSession.E2e().GetDHPrivateKey() // Generate bob's new keypair
// bobPubKey := bobSession.E2e().GetDHPublicKey() newBobPrivKey := dh.GeneratePrivateKey(dh.DefaultPrivateKeyLength, grp, csprng.NewSystemRNG())
// newBobPubKey := dh.GeneratePublicKey(newBobPrivKey, grp)
// // Generate bob's new keypair
// newBobPrivKey := dh.GeneratePrivateKey(dh.DefaultPrivateKeyLength, genericGroup, csprng.NewSystemRNG()) aliceVariant := sidh.KeyVariantSidhA
// newBobPubKey := dh.GeneratePublicKey(newBobPrivKey, genericGroup) prng1 := rand.New(rand.NewSource(int64(1)))
// aliceSIDHPrivKey := util.NewSIDHPrivateKey(aliceVariant)
// aliceVariant := sidh.KeyVariantSidhA aliceSIDHPubKey := util.NewSIDHPublicKey(aliceVariant)
// prng1 := rand.New(rand.NewSource(int64(1))) aliceSIDHPrivKey.Generate(prng1)
// aliceSIDHPrivKey := util.NewSIDHPrivateKey(aliceVariant) aliceSIDHPrivKey.GeneratePublicKey(aliceSIDHPubKey)
// aliceSIDHPubKey := util.NewSIDHPublicKey(aliceVariant)
// aliceSIDHPrivKey.Generate(prng1) bobVariant := sidh.KeyVariant(sidh.KeyVariantSidhB)
// aliceSIDHPrivKey.GeneratePublicKey(aliceSIDHPubKey) prng2 := rand.New(rand.NewSource(int64(2)))
// bobSIDHPrivKey := util.NewSIDHPrivateKey(bobVariant)
// bobVariant := sidh.KeyVariant(sidh.KeyVariantSidhB) bobSIDHPubKey := util.NewSIDHPublicKey(bobVariant)
// prng2 := rand.New(rand.NewSource(int64(2))) bobSIDHPrivKey.Generate(prng2)
// bobSIDHPrivKey := util.NewSIDHPrivateKey(bobVariant) bobSIDHPrivKey.GeneratePublicKey(bobSIDHPubKey)
// bobSIDHPubKey := util.NewSIDHPublicKey(bobVariant)
// bobSIDHPrivKey.Generate(prng2) newBobSIDHPrivKey := util.NewSIDHPrivateKey(bobVariant)
// bobSIDHPrivKey.GeneratePublicKey(bobSIDHPubKey) newBobSIDHPubKey := util.NewSIDHPublicKey(bobVariant)
// newBobSIDHPrivKey.Generate(prng2)
// newBobSIDHPrivKey := util.NewSIDHPrivateKey(bobVariant) newBobSIDHPrivKey.GeneratePublicKey(newBobSIDHPubKey)
// newBobSIDHPubKey := util.NewSIDHPublicKey(bobVariant) newBobSIDHPubKeyBytes := make([]byte, newBobSIDHPubKey.Size()+1)
// newBobSIDHPrivKey.Generate(prng2) newBobSIDHPubKeyBytes[0] = byte(bobVariant)
// newBobSIDHPrivKey.GeneratePublicKey(newBobSIDHPubKey) newBobSIDHPubKey.Export(newBobSIDHPubKeyBytes[1:])
// newBobSIDHPubKeyBytes := make([]byte, newBobSIDHPubKey.Size()+1)
// newBobSIDHPubKeyBytes[0] = byte(bobVariant) // Maintain an ID for bob
// newBobSIDHPubKey.Export(newBobSIDHPubKeyBytes[1:]) bobID = id.NewIdFromBytes([]byte("test"), t)
// myID = id.NewIdFromString("zezima", id.User, t)
// // Maintain an ID for bob kv := versioned.NewKV(ekv.Memstore{})
// bobID := id.NewIdFromBytes([]byte("test"), t)
// err := ratchet.New(kv, myID, alicePrivKey, grp)
// // Add bob as a partner if err != nil {
// aliceSession.E2e().AddPartner(bobID, bobSession.E2e().GetDHPublicKey(), t.Errorf("Failed to create ratchet: %+v", err)
// alicePrivKey, bobSIDHPubKey, aliceSIDHPrivKey, }
// params.GetDefaultE2ESessionParams(), r, err = ratchet.Load(kv, myID, grp, mockCyHandler{}, mockServiceHandler{}, rng)
// params.GetDefaultE2ESessionParams()) if err != nil {
// t.Errorf("Failed to load ratchet: %+v", err)
// // Generate a session ID, bypassing some business logic here }
// oldSessionID := GeneratePartnerID(alicePrivKey, bobPubKey, genericGroup,
// aliceSIDHPrivKey, bobSIDHPubKey) // Add bob as a partner
// sendParams := session2.GetDefaultE2ESessionParams()
// // Generate the message receiveParams := session2.GetDefaultE2ESessionParams()
// rekey, _ := proto.Marshal(&RekeyTrigger{ _, err = r.AddPartner(myID, bobID, bobPubKey, alicePrivKey, bobSIDHPubKey, aliceSIDHPrivKey, sendParams, receiveParams, false)
// SessionID: oldSessionID.Marshal(), if err != nil {
// PublicKey: newBobPubKey.Bytes(), t.Errorf("Failed to add partner to ratchet: %+v", err)
// SidhPublicKey: newBobSIDHPubKeyBytes, }
// }) _, err = r.AddPartner(bobID, myID, alicePubKey, bobPrivKey, aliceSIDHPubKey, bobSIDHPrivKey, sendParams, receiveParams, false)
// if err != nil {
// receiveMsg := message.Receive{ t.Errorf("Failed to add partner to ratchet: %+v", err)
// Payload: rekey, }
// MessageType: message.NoType, // Generate a session ID, bypassing some business logic here
// Sender: bobID, oldSessionID := GeneratePartnerID(alicePrivKey, bobPubKey, grp,
// Timestamp: netTime.Now(), aliceSIDHPrivKey, bobSIDHPubKey)
// Encryption: message.E2E,
// } // Generate the message
// rekey, _ := proto.Marshal(&RekeyTrigger{
// // Handle the trigger and check for an error SessionID: oldSessionID.Marshal(),
// rekeyParams := params.GetDefaultRekey() PublicKey: newBobPubKey.Bytes(),
// stop := stoppable.NewSingle("stoppable") SidhPublicKey: newBobSIDHPubKeyBytes,
// rekeyParams.RoundTimeout = 0 * time.Second })
// err = handleTrigger(aliceSession, aliceManager, receiveMsg, rekeyParams, stop)
// if err != nil { receiveMsg := receive.Message{
// t.Errorf("Handle trigger error: %v", err) Payload: rekey,
// } MessageType: catalog.NoType,
// Sender: bobID,
// // get Alice's manager for reception from Bob Timestamp: netTime.Now(),
// receivedManager, err := aliceSession.E2e().GetPartner(bobID) Encrypted: true,
// if err != nil { }
// t.Errorf("Failed to get bob's manager: %v", err)
// } // Handle the trigger and check for an error
// rekeyParams := GetDefaultParams()
// // Generate the new session ID based off of Bob's new keys stop := stoppable.NewSingle("stoppable")
// baseKey := session2.GenerateE2ESessionBaseKey(alicePrivKey, newBobPubKey, rekeyParams.RoundTimeout = 0 * time.Second
// genericGroup, aliceSIDHPrivKey, newBobSIDHPubKey) err = handleTrigger(r, testSendE2E, &mockNetManager{}, grp, receiveMsg, rekeyParams, stop)
// newSessionID := session2.GetSessionIDFromBaseKeyForTesting(baseKey, t) if err != nil {
// t.Errorf("Handle trigger error: %v", err)
// // Check that this new session ID is now in the manager }
// newSession := receivedManager.GetReceiveSession(newSessionID)
// if newSession == nil { // get Alice's manager for reception from Bob
// t.Errorf("Did not get expected session")
// } receivedManager, err := r.GetPartner(bobID, myID)
// if err != nil {
// // Generate a keypair alice will not recognize t.Errorf("Failed to get bob's manager: %v", err)
// unknownPrivateKey := dh.GeneratePrivateKey(dh.DefaultPrivateKeyLength, genericGroup, csprng.NewSystemRNG()) }
// unknownPubliceKey := dh.GeneratePublicKey(unknownPrivateKey, genericGroup)
// // Generate the new session ID based off of Bob's new keys
// // Generate a new session ID based off of these unrecognized keys baseKey := session2.GenerateE2ESessionBaseKey(alicePrivKey, newBobPubKey,
// badSessionID := session2.GetSessionIDFromBaseKeyForTesting(unknownPubliceKey, t) grp, aliceSIDHPrivKey, newBobSIDHPubKey)
// newSessionID := session2.GetSessionIDFromBaseKeyForTesting(baseKey, t)
// // Check that this session with unrecognized keys is not valid
// badSession := receivedManager.GetReceiveSession(badSessionID) // Check that this new session ID is now in the manager
// if badSession != nil { newSession := receivedManager.GetReceiveSession(newSessionID)
// t.Errorf("Alice found a session from an unknown keypair. "+ if newSession == nil {
// "\nSession: %v", badSession) t.Errorf("Did not get expected session")
// } }
//
//} // Generate a keypair alice will not recognize
unknownPrivateKey := dh.GeneratePrivateKey(dh.DefaultPrivateKeyLength, grp, csprng.NewSystemRNG())
unknownPubliceKey := dh.GeneratePublicKey(unknownPrivateKey, grp)
// Generate a new session ID based off of these unrecognized keys
badSessionID := session2.GetSessionIDFromBaseKeyForTesting(unknownPubliceKey, t)
// Check that this session with unrecognized keys is not valid
badSession := receivedManager.GetReceiveSession(badSessionID)
if badSession != nil {
t.Errorf("Alice found a session from an unknown keypair. "+
"\nSession: %v", badSession)
}
}
...@@ -14,13 +14,20 @@ import ( ...@@ -14,13 +14,20 @@ import (
session2 "gitlab.com/elixxir/client/e2e/ratchet/partner/session" session2 "gitlab.com/elixxir/client/e2e/ratchet/partner/session"
"gitlab.com/elixxir/client/e2e/receive" "gitlab.com/elixxir/client/e2e/receive"
"gitlab.com/elixxir/client/network" "gitlab.com/elixxir/client/network"
"gitlab.com/elixxir/client/network/gateway"
"gitlab.com/elixxir/client/network/historical"
"gitlab.com/elixxir/client/network/message" "gitlab.com/elixxir/client/network/message"
"gitlab.com/elixxir/client/stoppable"
util "gitlab.com/elixxir/client/storage/utility" util "gitlab.com/elixxir/client/storage/utility"
network2 "gitlab.com/elixxir/comms/network"
"gitlab.com/elixxir/crypto/cyclic" "gitlab.com/elixxir/crypto/cyclic"
"gitlab.com/elixxir/crypto/e2e" "gitlab.com/elixxir/crypto/e2e"
"gitlab.com/elixxir/crypto/hash" "gitlab.com/elixxir/crypto/hash"
"gitlab.com/elixxir/primitives/format"
"gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/crypto/large" "gitlab.com/xx_network/crypto/large"
"gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id/ephemeral"
"gitlab.com/xx_network/primitives/ndf" "gitlab.com/xx_network/primitives/ndf"
"gitlab.com/xx_network/primitives/netTime" "gitlab.com/xx_network/primitives/netTime"
"gitlab.com/xx_network/primitives/region" "gitlab.com/xx_network/primitives/region"
...@@ -84,7 +91,7 @@ func testSendE2E(mt catalog.MessageType, recipient *id.ID, payload []byte, cmixP ...@@ -84,7 +91,7 @@ func testSendE2E(mt catalog.MessageType, recipient *id.ID, payload []byte, cmixP
confirmMessage := receive.Message{ confirmMessage := receive.Message{
Payload: messagePayload, Payload: messagePayload,
MessageType: catalog.KeyExchangeConfirm, MessageType: catalog.KeyExchangeConfirm,
Sender: exchangeAliceId, Sender: myID,
Timestamp: netTime.Now(), Timestamp: netTime.Now(),
Encrypted: true, Encrypted: true,
} }
...@@ -94,71 +101,8 @@ func testSendE2E(mt catalog.MessageType, recipient *id.ID, payload []byte, cmixP ...@@ -94,71 +101,8 @@ func testSendE2E(mt catalog.MessageType, recipient *id.ID, payload []byte, cmixP
return rounds, e2e.MessageID{}, time.Time{}, nil return rounds, e2e.MessageID{}, time.Time{}, nil
} }
// Intended for alice to send to bob. Trigger's Bob's confirmation, chaining the operation
// together
//func (t *testNetworkManagerFullExchange) SendE2E(message.Send, params.E2E, *stoppable.Single) (
// []id.Round, cE2e.MessageID, time.Time, error) {
//
// rounds := []id.Round{id.Round(0), id.Round(1), id.Round(2)}
// alicePrivKey := aliceSession.E2e().GetDHPrivateKey()
// bobPubKey := bobSession.E2e().GetDHPublicKey()
//
// aliceVariant := sidh.KeyVariantSidhA
// prng1 := rand.New(rand.NewSource(int64(1)))
// aliceSIDHPrivKey := util.NewSIDHPrivateKey(aliceVariant)
// aliceSIDHPubKey := util.NewSIDHPublicKey(aliceVariant)
// aliceSIDHPrivKey.Generate(prng1)
// aliceSIDHPrivKey.GeneratePublicKey(aliceSIDHPubKey)
//
// bobVariant := sidh.KeyVariant(sidh.KeyVariantSidhB)
// prng2 := rand.New(rand.NewSource(int64(2)))
// bobSIDHPrivKey := util.NewSIDHPrivateKey(bobVariant)
// bobSIDHPubKey := util.NewSIDHPublicKey(bobVariant)
// bobSIDHPrivKey.Generate(prng2)
// bobSIDHPrivKey.GeneratePublicKey(bobSIDHPubKey)
//
// sessionID := GeneratePartnerID(alicePrivKey, bobPubKey, genericGroup,
// aliceSIDHPrivKey, bobSIDHPubKey)
//
// rekeyConfirm, _ := proto.Marshal(&RekeyConfirm{
// SessionID: sessionID.Marshal(),
// })
// payload := make([]byte, 0)
// payload = append(payload, rekeyConfirm...)
//
// confirmMessage := message.Receive{
// Payload: payload,
// MessageType: message.KeyExchangeConfirm,
// Sender: exchangeAliceId,
// Timestamp: netTime.Now(),
// Encryption: message.E2E,
// }
//
// bobSwitchboard.Speak(confirmMessage)
//
// return rounds, cE2e.MessageID{}, time.Time{}, nil
//}
var pub = "-----BEGIN CERTIFICATE-----\nMIIGHTCCBAWgAwIBAgIUOcAn9cpH+hyRH8/UfqtbFDoSxYswDQYJKoZIhvcNAQEL\nBQAwgZIxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTESMBAGA1UEBwwJQ2xhcmVt\nb250MRAwDgYDVQQKDAdFbGl4eGlyMRQwEgYDVQQLDAtEZXZlbG9wbWVudDEZMBcG\nA1UEAwwQZ2F0ZXdheS5jbWl4LnJpcDEfMB0GCSqGSIb3DQEJARYQYWRtaW5AZWxp\neHhpci5pbzAeFw0xOTA4MTYwMDQ4MTNaFw0yMDA4MTUwMDQ4MTNaMIGSMQswCQYD\nVQQGEwJVUzELMAkGA1UECAwCQ0ExEjAQBgNVBAcMCUNsYXJlbW9udDEQMA4GA1UE\nCgwHRWxpeHhpcjEUMBIGA1UECwwLRGV2ZWxvcG1lbnQxGTAXBgNVBAMMEGdhdGV3\nYXkuY21peC5yaXAxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGVsaXh4aXIuaW8wggIi\nMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC7Dkb6VXFn4cdpU0xh6ji0nTDQ\nUyT9DSNW9I3jVwBrWfqMc4ymJuonMZbuqK+cY2l+suS2eugevWZrtzujFPBRFp9O\n14Jl3fFLfvtjZvkrKbUMHDHFehascwzrp3tXNryiRMmCNQV55TfITVCv8CLE0t1i\nbiyOGM9ZWYB2OjXt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lg0DoLAtjea73WxjSCbdL3Nc0uNX/ymXVHdQ5husMCZbczc9LYdoT2VP\nD+GhkAuZV9g09COtRX4VP09zRdXiiBvweiq3K78ML7fISsY7kmc8KgVH22vcXvMX\nCgGwbrxi6QbQ80rWjGOzW5OxNFvjhvJ3vlbOT6r9cKZGIPY8IdN/zIyQxHiim0Jz\noavr9CPDdQefu9onizsmjsXFridjG/ctsJxcUEqK7R12zvaTxu/CVYZbYEUFjsCe\nq6ZAACiEJGvGeKbb/mSPvGs2P1kS70/cGp+P5kBCKqrm586FB7BcafHmGFrWhT3E\nLOUYkOV/gADT2hVDCrkPosg7Wb6ND9/mhCVVhf4hLGRh\n-----END CERTIFICATE-----\n"
//var genericGroup = cyclic.NewGroup(
// large.NewIntFromString("9DB6FB5951B66BB6FE1E140F1D2CE5502374161FD6538DF1648218642F0B5C48"+
// "C8F7A41AADFA187324B87674FA1822B00F1ECF8136943D7C55757264E5A1A44F"+
// "FE012E9936E00C1D3E9310B01C7D179805D3058B2A9F4BB6F9716BFE6117C6B5"+
// "B3CC4D9BE341104AD4A80AD6C94E005F4B993E14F091EB51743BF33050C38DE2"+
// "35567E1B34C3D6A5C0CEAA1A0F368213C3D19843D0B4B09DCB9FC72D39C8DE41"+
// "F1BF14D4BB4563CA28371621CAD3324B6A2D392145BEBFAC748805236F5CA2FE"+
// "92B871CD8F9C36D3292B5509CA8CAA77A2ADFC7BFD77DDA6F71125A7456FEA15"+
// "3E433256A2261C6A06ED3693797E7995FAD5AABBCFBE3EDA2741E375404AE25B", 16),
// large.NewIntFromString("5C7FF6B06F8F143FE8288433493E4769C4D988ACE5BE25A0E24809670716C613"+
// "D7B0CEE6932F8FAA7C44D2CB24523DA53FBE4F6EC3595892D1AA58C4328A06C4"+
// "6A15662E7EAA703A1DECF8BBB2D05DBE2EB956C142A338661D10461C0D135472"+
// "085057F3494309FFA73C611F78B32ADBB5740C361C9F35BE90997DB2014E2EF5"+
// "AA61782F52ABEB8BD6432C4DD097BC5423B285DAFB60DC364E8161F4A2A35ACA"+
// "3A10B1C4D203CC76A470A33AFDCBDD92959859ABD8B56E1725252D78EAC66E71"+
// "BA9AE3F1DD2487199874393CD4D832186800654760E1E34C09E4D155179F9EC0"+
// "DC4473F996BDCE6EED1CABED8B6F116F7AD9CF505DF0F998E34AB27514B0FFE7", 16))
func getNDF(t *testing.T) *ndf.NetworkDefinition { func getNDF(t *testing.T) *ndf.NetworkDefinition {
return &ndf.NetworkDefinition{ return &ndf.NetworkDefinition{
E2E: ndf.Group{ E2E: ndf.Group{
...@@ -258,3 +202,119 @@ func (m mockServiceHandler) DeleteService(clientID *id.ID, toDelete message.Serv ...@@ -258,3 +202,119 @@ func (m mockServiceHandler) DeleteService(clientID *id.ID, toDelete message.Serv
processor message.Processor) { processor message.Processor) {
return return
} }
type mockNetManager struct{}
func (m *mockNetManager) Follow(report network.ClientErrorReport) (stoppable.Stoppable, error) {
return nil, nil
}
func (m *mockNetManager) GetMaxMessageLength() int {
return 0
}
func (m *mockNetManager) SendCMIX(recipient *id.ID, fingerprint format.Fingerprint,
service message.Service, payload, mac []byte, cmixParams network.CMIXParams) (
id.Round, ephemeral.Id, error) {
return id.Round(0), ephemeral.Id{}, nil
}
func (m *mockNetManager) SendManyCMIX(messages []network.TargetedCmixMessage, p network.CMIXParams) (
id.Round, []ephemeral.Id, error) {
return id.Round(0), nil, nil
}
func (m *mockNetManager) AddIdentity(id *id.ID, validUntil time.Time, persistent bool) {}
func (m *mockNetManager) RemoveIdentity(id *id.ID) {}
func (m *mockNetManager) AddFingerprint(identity *id.ID, fingerprint format.Fingerprint,
mp message.Processor) error {
return nil
}
func (m *mockNetManager) DeleteFingerprint(identity *id.ID, fingerprint format.Fingerprint) {}
func (m *mockNetManager) DeleteClientFingerprints(identity *id.ID) {}
func (m *mockNetManager) AddService(clientID *id.ID, newService message.Service,
response message.Processor) {
}
func (m *mockNetManager) DeleteService(clientID *id.ID, toDelete message.Service,
processor message.Processor) {
}
func (m *mockNetManager) DeleteClientService(clientID *id.ID) {}
func (m *mockNetManager) TrackServices(tracker message.ServicesTracker) {}
func (m *mockNetManager) CheckInProgressMessages() {}
func (m *mockNetManager) IsHealthy() bool {
return true
}
func (m *mockNetManager) WasHealthy() bool {
return true
}
func (m *mockNetManager) AddHealthCallback(f func(bool)) uint64 {
return 0
}
func (m *mockNetManager) RemoveHealthCallback(uint64) {}
func (m *mockNetManager) HasNode(nid *id.ID) bool {
return true
}
func (m *mockNetManager) NumRegisteredNodes() int {
return 0
}
func (m *mockNetManager) TriggerNodeRegistration(nid *id.ID) {}
func (m *mockNetManager) GetRoundResults(timeout time.Duration, roundCallback network.RoundEventCallback,
roundList ...id.Round) error {
return nil
}
func (m *mockNetManager) LookupHistoricalRound(
rid id.Round, callback historical.RoundResultCallback) error {
return nil
}
func (m *mockNetManager) SendToAny(sendFunc func(host *connect.Host) (interface{}, error),
stop *stoppable.Single) (interface{}, error) {
return nil, nil
}
func (m *mockNetManager) SendToPreferred(targets []*id.ID, sendFunc gateway.SendToPreferredFunc,
stop *stoppable.Single, timeout time.Duration) (interface{}, error) {
return nil, nil
}
func (m *mockNetManager) SetGatewayFilter(f gateway.Filter) {}
func (m *mockNetManager) GetHostParams() connect.HostParams {
return connect.GetDefaultHostParams()
}
func (m *mockNetManager) GetAddressSpace() uint8 {
return 0
}
func (m *mockNetManager) RegisterAddressSpaceNotification(tag string) (chan uint8, error) {
return make(chan uint8), nil
}
func (m *mockNetManager) UnregisterAddressSpaceNotification(tag string) {}
func (m *mockNetManager) GetInstance() *network2.Instance {
return nil
}
func (m *mockNetManager) GetVerboseRounds() string {
return ""
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment