Skip to content
Snippets Groups Projects
Commit 86d9f23c authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Remove the user session NodeKeys interface and fix most tests for new NodeKeys...

Remove the user session NodeKeys interface and fix most tests for new NodeKeys storage session interface
parent 5301dfe4
Branches
Tags
No related merge requests found
...@@ -17,6 +17,7 @@ import ( ...@@ -17,6 +17,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"gitlab.com/elixxir/client/bots" "gitlab.com/elixxir/client/bots"
"gitlab.com/elixxir/client/cmixproto" "gitlab.com/elixxir/client/cmixproto"
clientcrypto "gitlab.com/elixxir/client/crypto"
"gitlab.com/elixxir/client/globals" "gitlab.com/elixxir/client/globals"
"gitlab.com/elixxir/client/io" "gitlab.com/elixxir/client/io"
"gitlab.com/elixxir/client/keyStore" "gitlab.com/elixxir/client/keyStore"
...@@ -109,6 +110,17 @@ func newClient(s globals.Storage, locA, locB string, ndfJSON *ndf.NetworkDefinit ...@@ -109,6 +110,17 @@ func newClient(s globals.Storage, locA, locB string, ndfJSON *ndf.NetworkDefinit
cl.ndf = ndfJSON cl.ndf = ndfJSON
cl.sendFunc = sendFunc cl.sendFunc = sendFunc
// TODO: FIX ME
// While the old session is still valid, we are using the LocA storage to initialize the session
dirname := filepath.Dir(locA)
//FIXME: We need to accept the user's password here!
io.SessionV2, err = storage.Init(dirname, "DUMMYPASSWORDFIXME")
if err != nil {
return nil, errors.Wrap(err, "Login: could not initialize v2 storage")
}
clientcrypto.SessionV2 = io.SessionV2
cl.sessionV2 = io.SessionV2
//Create the cmix group and init the registry //Create the cmix group and init the registry
cmixGrp := cyclic.NewGroup( cmixGrp := cyclic.NewGroup(
large.NewIntFromString(cl.ndf.CMIX.Prime, 16), large.NewIntFromString(cl.ndf.CMIX.Prime, 16),
...@@ -159,17 +171,7 @@ func (cl *Client) Login(password string) (*id.ID, error) { ...@@ -159,17 +171,7 @@ func (cl *Client) Login(password string) (*id.ID, error) {
cl.session = session cl.session = session
// TODO: FIX ME regState, err := cl.sessionV2.GetRegState()
// While the old session is still valid, we are using the LocA storage to initialize the session
locA, _ := cl.storage.GetLocation()
dirname := filepath.Dir(locA)
io.SessionV2, err = storage.Init(dirname, password)
if err != nil {
return nil, errors.Wrap(err, "Login: could not initialize v2 storage")
}
cl.sessionV2 = io.SessionV2
regState, err := io.SessionV2.GetRegState()
// fixme ! // fixme !
if err != nil && os.IsNotExist(err) { if err != nil && os.IsNotExist(err) {
io.SessionV2.SetRegState(user.KeyGenComplete) io.SessionV2.SetRegState(user.KeyGenComplete)
......
...@@ -596,6 +596,9 @@ func TestClient_LogoutHappyPath(t *testing.T) { ...@@ -596,6 +596,9 @@ func TestClient_LogoutHappyPath(t *testing.T) {
t.Errorf("Could not connect: %+v", err) t.Errorf("Could not connect: %+v", err)
} }
tc.sessionV2, err = storage.Init(".ekv-logouthappypath", "password")
io.SessionV2 = tc.sessionV2
err = tc.GenerateKeys(nil, "") err = tc.GenerateKeys(nil, "")
if err != nil { if err != nil {
t.Errorf("Could not generate Keys: %+v", err) t.Errorf("Could not generate Keys: %+v", err)
......
...@@ -11,8 +11,9 @@ import ( ...@@ -11,8 +11,9 @@ import (
"fmt" "fmt"
jww "github.com/spf13/jwalterweatherman" jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/io" "gitlab.com/elixxir/client/io"
clientStorage "gitlab.com/elixxir/client/storage" //clientStorage "gitlab.com/elixxir/client/storage"
"gitlab.com/elixxir/client/user" "gitlab.com/elixxir/client/user"
//"gitlab.com/elixxir/client/crypto"
"gitlab.com/elixxir/comms/gateway" "gitlab.com/elixxir/comms/gateway"
pb "gitlab.com/elixxir/comms/mixmessages" pb "gitlab.com/elixxir/comms/mixmessages"
"gitlab.com/elixxir/comms/notificationBot" "gitlab.com/elixxir/comms/notificationBot"
...@@ -60,7 +61,6 @@ func TestMain(m *testing.M) { ...@@ -60,7 +61,6 @@ func TestMain(m *testing.M) {
// Set logging params // Set logging params
jww.SetLogThreshold(jww.LevelTrace) jww.SetLogThreshold(jww.LevelTrace)
jww.SetStdoutThreshold(jww.LevelTrace) jww.SetStdoutThreshold(jww.LevelTrace)
io.SessionV2, _ = clientStorage.Init(".ekvapi", "test")
os.Exit(testMainWrapper(m)) os.Exit(testMainWrapper(m))
} }
......
...@@ -63,7 +63,7 @@ func (cl *Client) RegisterWithPermissioning(preCan bool, registrationCode string ...@@ -63,7 +63,7 @@ func (cl *Client) RegisterWithPermissioning(preCan bool, registrationCode string
//store the node keys //store the node keys
for n, k := range nodeKeyMap { for n, k := range nodeKeyMap {
cl.session.PushNodeKey(&n, k) cl.sessionV2.PushNodeKey(&n, k)
} }
//update the state //update the state
...@@ -331,7 +331,7 @@ func (cl *Client) registerWithNode(index int, salt, registrationValidationSignat ...@@ -331,7 +331,7 @@ func (cl *Client) registerWithNode(index int, salt, registrationValidationSignat
ReceptionKey: registration.GenerateBaseKey(cmixGrp, serverPubDH, ReceptionKey: registration.GenerateBaseKey(cmixGrp, serverPubDH,
cmixPrivateKeyDH, receptionHash), cmixPrivateKeyDH, receptionHash),
} }
cl.session.PushNodeKey(nodeID, key) cl.sessionV2.PushNodeKey(nodeID, key)
} }
//registerWithPermissioning serves as a helper function for RegisterWithPermissioning. //registerWithPermissioning serves as a helper function for RegisterWithPermissioning.
......
...@@ -6,11 +6,9 @@ ...@@ -6,11 +6,9 @@
package api package api
import ( import (
"crypto/sha256"
"gitlab.com/elixxir/client/globals" "gitlab.com/elixxir/client/globals"
"gitlab.com/elixxir/client/io" "gitlab.com/elixxir/client/io"
"gitlab.com/elixxir/client/user" "gitlab.com/elixxir/client/user"
"gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id"
"testing" "testing"
) )
...@@ -53,7 +51,6 @@ func TestRegistrationGob(t *testing.T) { ...@@ -53,7 +51,6 @@ func TestRegistrationGob(t *testing.T) {
} }
VerifyRegisterGobUser(Session, t) VerifyRegisterGobUser(Session, t)
VerifyRegisterGobKeys(Session, testClient.topology, t)
disconnectServers() disconnectServers()
} }
...@@ -99,7 +96,6 @@ func TestClient_Register(t *testing.T) { ...@@ -99,7 +96,6 @@ func TestClient_Register(t *testing.T) {
VerifyRegisterGobUser(Session, t) VerifyRegisterGobUser(Session, t)
VerifyRegisterGobKeys(Session, testClient.topology, t)
disconnectServers() disconnectServers()
} }
...@@ -114,22 +110,6 @@ func VerifyRegisterGobUser(session user.Session, t *testing.T) { ...@@ -114,22 +110,6 @@ func VerifyRegisterGobUser(session user.Session, t *testing.T) {
} }
} }
//Verify that the keys from the session in the registration above match the expected keys
func VerifyRegisterGobKeys(session user.Session, topology *connect.Circuit, t *testing.T) {
cmixGrp, _ := getGroups()
h := sha256.New()
h.Write([]byte(string(40005)))
expectedTransmissionBaseKey := cmixGrp.NewIntFromBytes(h.Sum(nil))
if session.GetNodeKeys(topology)[0].TransmissionKey.Cmp(
expectedTransmissionBaseKey) != 0 {
t.Errorf("Transmission base key was %v, expected %v",
session.GetNodeKeys(topology)[0].TransmissionKey.Text(16),
expectedTransmissionBaseKey.Text(16))
}
}
// Verify that a valid precanned user can register // Verify that a valid precanned user can register
func TestRegister_ValidRegParams___(t *testing.T) { func TestRegister_ValidRegParams___(t *testing.T) {
// Initialize client with dummy storage // Initialize client with dummy storage
......
...@@ -8,6 +8,7 @@ package crypto ...@@ -8,6 +8,7 @@ package crypto
import ( import (
"gitlab.com/elixxir/client/globals" "gitlab.com/elixxir/client/globals"
"gitlab.com/elixxir/client/storage"
"gitlab.com/elixxir/client/user" "gitlab.com/elixxir/client/user"
"gitlab.com/elixxir/crypto/cmix" "gitlab.com/elixxir/crypto/cmix"
"gitlab.com/elixxir/crypto/cyclic" "gitlab.com/elixxir/crypto/cyclic"
...@@ -17,16 +18,23 @@ import ( ...@@ -17,16 +18,23 @@ import (
"gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/comms/connect"
) )
// TODO: REMOVE ME
var SessionV2 *storage.Session
// CMIX Encrypt performs the encryption // CMIX Encrypt performs the encryption
// of the msg to a team of nodes // of the msg to a team of nodes
// It returns a new msg // It returns a new msg
func CMIXEncrypt(session user.Session, topology *connect.Circuit, salt []byte, func CMIXEncrypt(session user.Session, topology *connect.Circuit, salt []byte,
msg *format.Message) (*format.Message, [][]byte) { msg *format.Message) (*format.Message, [][]byte) {
// Generate the encryption key // Generate the encryption key
nodeKeys := session.GetNodeKeys(topology) nodeKeys, err := SessionV2.GetNodeKeys(topology)
if err != nil {
globals.Log.FATAL.Panicf("could not get nodeKeys: %+v", err)
}
baseKeys := make([]*cyclic.Int, len(nodeKeys)) baseKeys := make([]*cyclic.Int, len(nodeKeys))
for i, key := range nodeKeys { for i, key := range nodeKeys {
globals.Log.WARN.Printf("NodeKey for %d: %v", i, key.TransmissionKey)
baseKeys[i] = key.TransmissionKey baseKeys[i] = key.TransmissionKey
} }
......
...@@ -9,6 +9,8 @@ package crypto ...@@ -9,6 +9,8 @@ package crypto
import ( import (
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"fmt"
"gitlab.com/elixxir/client/storage"
"gitlab.com/elixxir/client/user" "gitlab.com/elixxir/client/user"
pb "gitlab.com/elixxir/comms/mixmessages" pb "gitlab.com/elixxir/comms/mixmessages"
"gitlab.com/elixxir/crypto/cmix" "gitlab.com/elixxir/crypto/cmix"
...@@ -71,6 +73,8 @@ func setup() { ...@@ -71,6 +73,8 @@ func setup() {
nil, nil, nil, nil, nil, nil,
nil, nil, cmixGrp, e2eGrp, "password") nil, nil, cmixGrp, e2eGrp, "password")
SessionV2, _ = storage.Init(".ekvcryptotest", "password")
for i := 0; i < numNodes; i++ { for i := 0; i < numNodes; i++ {
nk := user.NodeKeys{} nk := user.NodeKeys{}
...@@ -85,7 +89,9 @@ func setup() { ...@@ -85,7 +89,9 @@ func setup() {
cmix.NodeKeyGen(cmixGrp, h.Sum(nil), nk.TransmissionKey, tempKey) cmix.NodeKeyGen(cmixGrp, h.Sum(nil), nk.TransmissionKey, tempKey)
cmixGrp.Mul(serverPayloadBKey, tempKey, serverPayloadBKey) cmixGrp.Mul(serverPayloadBKey, tempKey, serverPayloadBKey)
session.PushNodeKey(topology.GetNodeAtIndex(i), nk) SessionV2.PushNodeKey(topology.GetNodeAtIndex(i), nk)
fmt.Printf("Saved NodeKey: %s, %v", topology.GetNodeAtIndex(i),
nk.TransmissionKey)
} }
......
...@@ -150,7 +150,11 @@ func (rm *ReceptionManager) send(session user.Session, topology *connect.Circuit ...@@ -150,7 +150,11 @@ func (rm *ReceptionManager) send(session user.Session, topology *connect.Circuit
} }
// Retrieve the base key for the zeroeth node // Retrieve the base key for the zeroeth node
nodeKeys := session.GetNodeKeys(topology) nodeKeys, err := SessionV2.GetNodeKeys(topology)
if err != nil {
globals.Log.ERROR.Printf("could not get nodeKeys: %+v", err)
return err
}
nk := nodeKeys[0] nk := nodeKeys[0]
clientGatewayKey := cmix.GenerateClientGatewayKey(nk.TransmissionKey) clientGatewayKey := cmix.GenerateClientGatewayKey(nk.TransmissionKey)
......
...@@ -21,7 +21,6 @@ import ( ...@@ -21,7 +21,6 @@ import (
"gitlab.com/elixxir/crypto/signature/rsa" "gitlab.com/elixxir/crypto/signature/rsa"
"gitlab.com/elixxir/primitives/format" "gitlab.com/elixxir/primitives/format"
"gitlab.com/elixxir/primitives/switchboard" "gitlab.com/elixxir/primitives/switchboard"
"gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id"
"io" "io"
"sync" "sync"
...@@ -35,8 +34,6 @@ var ErrQuery = errors.New("element not in map") ...@@ -35,8 +34,6 @@ var ErrQuery = errors.New("element not in map")
// Interface for User Session operations // Interface for User Session operations
type Session interface { type Session interface {
GetCurrentUser() (currentUser *User) GetCurrentUser() (currentUser *User)
GetNodeKeys(topology *connect.Circuit) []NodeKeys
PushNodeKey(id *id.ID, key NodeKeys)
GetRSAPrivateKey() *rsa.PrivateKey GetRSAPrivateKey() *rsa.PrivateKey
GetRSAPublicKey() *rsa.PublicKey GetRSAPublicKey() *rsa.PublicKey
GetCMIXDHPrivateKey() *cyclic.Int GetCMIXDHPrivateKey() *cyclic.Int
...@@ -366,28 +363,6 @@ func (s *SessionObj) GetSalt() []byte { ...@@ -366,28 +363,6 @@ func (s *SessionObj) GetSalt() []byte {
return salt return salt
} }
func (s *SessionObj) GetNodeKeys(topology *connect.Circuit) []NodeKeys {
s.LockStorage()
defer s.UnlockStorage()
keys := make([]NodeKeys, topology.Len())
for i := 0; i < topology.Len(); i++ {
keys[i] = s.NodeKeys[*topology.GetNodeAtIndex(i)]
}
return keys
}
func (s *SessionObj) PushNodeKey(id *id.ID, key NodeKeys) {
s.LockStorage()
defer s.UnlockStorage()
s.NodeKeys[*id] = key
return
}
//RegisterPermissioningSignature sets sessions registration signature and //RegisterPermissioningSignature sets sessions registration signature and
// sets the regState to reflect that registering with permissioning is complete // sets the regState to reflect that registering with permissioning is complete
// Returns an error if unable to set the regState // Returns an error if unable to set the regState
......
...@@ -15,7 +15,6 @@ import ( ...@@ -15,7 +15,6 @@ import (
"gitlab.com/elixxir/crypto/large" "gitlab.com/elixxir/crypto/large"
"gitlab.com/elixxir/crypto/signature/rsa" "gitlab.com/elixxir/crypto/signature/rsa"
"gitlab.com/elixxir/primitives/format" "gitlab.com/elixxir/primitives/format"
"gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id"
"math/rand" "math/rand"
"reflect" "reflect"
...@@ -26,7 +25,6 @@ import ( ...@@ -26,7 +25,6 @@ import (
// surrounding the User struct and the Registry interface // surrounding the User struct and the Registry interface
func TestUserSession(t *testing.T) { func TestUserSession(t *testing.T) {
test := 11
pass := 0 pass := 0
u := new(User) u := new(User)
...@@ -37,12 +35,6 @@ func TestUserSession(t *testing.T) { ...@@ -37,12 +35,6 @@ func TestUserSession(t *testing.T) {
u.User = id.NewIdFromUInt(UID, id.User, t) u.User = id.NewIdFromUInt(UID, id.User, t)
u.Username = "Mario" u.Username = "Mario"
grp := cyclic.NewGroup(large.NewInt(107), large.NewInt(2))
nodeID := id.NewIdFromUInt(1, id.Node, t)
topology := connect.NewCircuit([]*id.ID{nodeID})
// Storage // Storage
storage := &globals.RamStorage{} storage := &globals.RamStorage{}
...@@ -72,11 +64,6 @@ func TestUserSession(t *testing.T) { ...@@ -72,11 +64,6 @@ func TestUserSession(t *testing.T) {
err.Error()) err.Error())
} }
ses.PushNodeKey(nodeID, NodeKeys{
TransmissionKey: grp.NewInt(2),
ReceptionKey: grp.NewInt(2),
})
ses.SetLastMessageID("totally unique ID") ses.SetLastMessageID("totally unique ID")
err = ses.StoreSession() err = ses.StoreSession()
...@@ -114,41 +101,6 @@ func TestUserSession(t *testing.T) { ...@@ -114,41 +101,6 @@ func TestUserSession(t *testing.T) {
pass++ pass++
} }
if ses.GetNodeKeys(topology) == nil {
t.Errorf("Keys not set correctly!")
} else {
test += len(ses.GetNodeKeys(topology))
for i := 0; i < len(ses.GetNodeKeys(topology)); i++ {
orig := privateKey.PrivateKey
sesPriv := ses.GetRSAPrivateKey().PrivateKey
if !reflect.DeepEqual(*ses.GetRSAPublicKey(), publicKey) {
t.Errorf("Error: Public key not set correctly!")
} else if sesPriv.E != orig.E {
t.Errorf("Error: Private key not set correctly E! \nExpected: %+v\nreceived: %+v",
orig.E, sesPriv.E)
} else if sesPriv.D.Cmp(orig.D) != 0 {
t.Errorf("Error: Private key not set correctly D! \nExpected: %+v\nreceived: %+v",
orig.D, sesPriv.D)
} else if sesPriv.N.Cmp(orig.N) != 0 {
t.Errorf("Error: Private key not set correctly N! \nExpected: %+v\nreceived: %+v",
orig.N, sesPriv.N)
} else if !reflect.DeepEqual(sesPriv.Primes, orig.Primes) {
t.Errorf("Error: Private key not set correctly PRIMES! \nExpected: %+v\nreceived: %+v",
orig, sesPriv)
} else if ses.GetNodeKeys(topology)[i].ReceptionKey.Cmp(grp.
NewInt(2)) != 0 {
t.Errorf("Reception key not set correct!")
} else if ses.GetNodeKeys(topology)[i].TransmissionKey.Cmp(
grp.NewInt(2)) != 0 {
t.Errorf("Transmission key not set correctly!")
}
pass++
}
}
//TODO: FIX THIS? //TODO: FIX THIS?
if ses.GetRSAPrivateKey() == nil { if ses.GetRSAPrivateKey() == nil {
t.Errorf("Error: Private Keys not set correctly!") t.Errorf("Error: Private Keys not set correctly!")
...@@ -223,10 +175,6 @@ func TestSessionObj_DeleteContact(t *testing.T) { ...@@ -223,10 +175,6 @@ func TestSessionObj_DeleteContact(t *testing.T) {
u.User = id.NewIdFromUInt(UID, id.User, t) u.User = id.NewIdFromUInt(UID, id.User, t)
u.Username = "Mario" u.Username = "Mario"
grp := cyclic.NewGroup(large.NewInt(107), large.NewInt(2))
nodeID := id.NewIdFromUInt(1, id.Node, t)
// Storage // Storage
storage := &globals.RamStorage{} storage := &globals.RamStorage{}
...@@ -256,11 +204,6 @@ func TestSessionObj_DeleteContact(t *testing.T) { ...@@ -256,11 +204,6 @@ func TestSessionObj_DeleteContact(t *testing.T) {
err.Error()) err.Error())
} }
ses.PushNodeKey(nodeID, NodeKeys{
TransmissionKey: grp.NewInt(2),
ReceptionKey: grp.NewInt(2),
})
testContact := id.NewIdFromString("test", id.User, t) testContact := id.NewIdFromString("test", id.User, t)
ses.StoreContactByValue("test", testContact, []byte("test")) ses.StoreContactByValue("test", testContact, []byte("test"))
...@@ -277,8 +220,6 @@ func TestGetPubKey(t *testing.T) { ...@@ -277,8 +220,6 @@ func TestGetPubKey(t *testing.T) {
u.User = UID u.User = UID
u.Username = "Mario" u.Username = "Mario"
grp := cyclic.NewGroup(large.NewInt(107), large.NewInt(2))
rng := rand.New(rand.NewSource(42)) rng := rand.New(rand.NewSource(42))
privateKey, _ := rsa.GenerateKey(rng, 768) privateKey, _ := rsa.GenerateKey(rng, 768)
publicKey := rsa.PublicKey{PublicKey: privateKey.PublicKey} publicKey := rsa.PublicKey{PublicKey: privateKey.PublicKey}
...@@ -305,11 +246,6 @@ func TestGetPubKey(t *testing.T) { ...@@ -305,11 +246,6 @@ func TestGetPubKey(t *testing.T) {
err.Error()) err.Error())
} }
ses.PushNodeKey(id.NewIdFromUInt(1, id.Node, t), NodeKeys{
TransmissionKey: grp.NewInt(2),
ReceptionKey: grp.NewInt(2),
})
pubKey := *ses.GetRSAPublicKey() pubKey := *ses.GetRSAPublicKey()
if !reflect.DeepEqual(pubKey, publicKey) { if !reflect.DeepEqual(pubKey, publicKey) {
t.Errorf("Public key not returned correctly!") t.Errorf("Public key not returned correctly!")
...@@ -327,9 +263,6 @@ func TestSessionObj_StorageIsEmpty(t *testing.T) { ...@@ -327,9 +263,6 @@ func TestSessionObj_StorageIsEmpty(t *testing.T) {
u.User = id.NewIdFromUInt(UID, id.User, t) u.User = id.NewIdFromUInt(UID, id.User, t)
u.Username = "Mario" u.Username = "Mario"
grp := cyclic.NewGroup(large.NewInt(107), large.NewInt(2))
nodeID := id.NewIdFromUInt(1, id.Node, t)
// Storage // Storage
storage := &globals.RamStorage{} storage := &globals.RamStorage{}
...@@ -351,11 +284,6 @@ func TestSessionObj_StorageIsEmpty(t *testing.T) { ...@@ -351,11 +284,6 @@ func TestSessionObj_StorageIsEmpty(t *testing.T) {
regSignature := make([]byte, 768) regSignature := make([]byte, 768)
rng.Read(regSignature) rng.Read(regSignature)
ses.PushNodeKey(nodeID, NodeKeys{
TransmissionKey: grp.NewInt(2),
ReceptionKey: grp.NewInt(2),
})
ses.SetLastMessageID("totally unique ID") ses.SetLastMessageID("totally unique ID")
//Test that the session is empty before the StoreSession call //Test that the session is empty before the StoreSession call
...@@ -385,10 +313,6 @@ func TestSessionObj_GetContactByValue(t *testing.T) { ...@@ -385,10 +313,6 @@ func TestSessionObj_GetContactByValue(t *testing.T) {
u.User = id.NewIdFromUInt(UID, id.User, t) u.User = id.NewIdFromUInt(UID, id.User, t)
u.Username = "Mario" u.Username = "Mario"
grp := cyclic.NewGroup(large.NewInt(107), large.NewInt(2))
nodeID := id.NewIdFromUInt(1, id.Node, t)
// Storage // Storage
storage := &globals.RamStorage{} storage := &globals.RamStorage{}
...@@ -416,11 +340,6 @@ func TestSessionObj_GetContactByValue(t *testing.T) { ...@@ -416,11 +340,6 @@ func TestSessionObj_GetContactByValue(t *testing.T) {
err.Error()) err.Error())
} }
ses.PushNodeKey(nodeID, NodeKeys{
TransmissionKey: grp.NewInt(2),
ReceptionKey: grp.NewInt(2),
})
userId := id.NewIdFromBytes([]byte("test"), t) userId := id.NewIdFromBytes([]byte("test"), t)
ses.StoreContactByValue("value", userId, []byte("test")) ses.StoreContactByValue("value", userId, []byte("test"))
...@@ -445,8 +364,6 @@ func TestGetPrivKey(t *testing.T) { ...@@ -445,8 +364,6 @@ func TestGetPrivKey(t *testing.T) {
u.User = UID u.User = UID
u.Username = "Mario" u.Username = "Mario"
grp := cyclic.NewGroup(large.NewInt(107), large.NewInt(2))
rng := rand.New(rand.NewSource(42)) rng := rand.New(rand.NewSource(42))
privateKey, _ := rsa.GenerateKey(rng, 768) privateKey, _ := rsa.GenerateKey(rng, 768)
publicKey := rsa.PublicKey{PublicKey: privateKey.PublicKey} publicKey := rsa.PublicKey{PublicKey: privateKey.PublicKey}
...@@ -473,11 +390,6 @@ func TestGetPrivKey(t *testing.T) { ...@@ -473,11 +390,6 @@ func TestGetPrivKey(t *testing.T) {
err.Error()) err.Error())
} }
ses.PushNodeKey(id.NewIdFromUInt(1, id.Node, t), NodeKeys{
TransmissionKey: grp.NewInt(2),
ReceptionKey: grp.NewInt(2),
})
privKey := ses.GetRSAPrivateKey() privKey := ses.GetRSAPrivateKey()
if !reflect.DeepEqual(*privKey, *privateKey) { if !reflect.DeepEqual(*privKey, *privateKey) {
t.Errorf("Private key is not returned correctly!") t.Errorf("Private key is not returned correctly!")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment