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

Update keyExchange for SIDH

parent 7bd65318
No related branches found
No related tags found
2 merge requests!117Release,!73Quantum secure xx messenger key negotiation
......@@ -60,7 +60,8 @@ func TestHandleConfirm(t *testing.T) {
params.GetDefaultE2ESessionParams())
// Generate a session ID, bypassing some business logic here
sessionID := GeneratePartnerID(alicePrivKey, bobPubKey, genericGroup)
sessionID := GeneratePartnerID(alicePrivKey, bobPubKey, genericGroup,
aliceSIDHPrivKey, bobSIDHPubKey)
// Get Alice's manager for Bob
receivedManager, err := aliceSession.E2e().GetPartner(bobID)
......
......@@ -83,7 +83,8 @@ func TestFullExchange(t *testing.T) {
Start(bobSwitchboard, bobSession, bobManager, rekeyParams)
// Generate a session ID, bypassing some business logic here
oldSessionID := GeneratePartnerID(alicePrivKey, bobPubKey, genericGroup)
oldSessionID := GeneratePartnerID(alicePrivKey, bobPubKey, genericGroup,
aliceSIDHPrivKey, bobSIDHPubKey)
// Generate the message
rekeyTrigger, _ := proto.Marshal(&RekeyTrigger{
......
......@@ -68,7 +68,8 @@ func TestHandleTrigger(t *testing.T) {
params.GetDefaultE2ESessionParams())
// Generate a session ID, bypassing some business logic here
oldSessionID := GeneratePartnerID(alicePrivKey, bobPubKey, genericGroup)
oldSessionID := GeneratePartnerID(alicePrivKey, bobPubKey, genericGroup,
aliceSIDHPrivKey, bobSIDHPubKey)
// Generate the message
rekey, _ := proto.Marshal(&RekeyTrigger{
......
......@@ -20,7 +20,6 @@ import (
"gitlab.com/elixxir/client/switchboard"
"gitlab.com/elixxir/comms/network"
"gitlab.com/elixxir/crypto/cyclic"
dh "gitlab.com/elixxir/crypto/diffieHellman"
cE2e "gitlab.com/elixxir/crypto/e2e"
"gitlab.com/elixxir/crypto/hash"
"gitlab.com/elixxir/primitives/format"
......@@ -32,12 +31,17 @@ import (
"gitlab.com/xx_network/primitives/netTime"
"testing"
"time"
"github.com/cloudflare/circl/dh/sidh"
"math/rand"
util "gitlab.com/elixxir/client/storage/utility"
)
// Generate partner ID for two people, used for smoke tests
func GeneratePartnerID(aliceKey, bobKey *cyclic.Int,
group *cyclic.Group) e2e.SessionID {
baseKey := dh.GenerateSessionKey(aliceKey, bobKey, group)
group *cyclic.Group, alicePrivKey *sidh.PrivateKey,
bobPubKey *sidh.PublicKey) e2e.SessionID {
baseKey := e2e.GenerateE2ESessionBaseKey(aliceKey, bobKey, group,
alicePrivKey, bobPubKey)
h, _ := hash.NewCMixHash()
h.Write(baseKey.Bytes())
......@@ -190,7 +194,22 @@ func (t *testNetworkManagerFullExchange) SendE2E(message.Send, params.E2E, *stop
alicePrivKey := aliceSession.E2e().GetDHPrivateKey()
bobPubKey := bobSession.E2e().GetDHPublicKey()
sessionID := GeneratePartnerID(alicePrivKey, bobPubKey, genericGroup)
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(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment