From 6d2304df43d7d73c0ec1d5e69b8aa808c3666d6c Mon Sep 17 00:00:00 2001 From: Jono Wenger <jono@elixxir.io> Date: Thu, 14 Apr 2022 10:54:42 -0700 Subject: [PATCH] Fix single use formatting and error messages --- e2e/singleUse/mac.go | 4 +-- e2e/singleUse/mac_test.go | 12 +++++---- e2e/singleUse/recipientID.go | 4 +-- e2e/singleUse/recipientID_test.go | 33 +++++++++++++++-------- e2e/singleUse/responseFingerprint.go | 4 +-- e2e/singleUse/responseFingerprint_test.go | 11 +++++--- e2e/singleUse/responseKey.go | 4 +-- e2e/singleUse/responseKey_test.go | 11 +++++--- e2e/singleUse/tagFingerprint.go | 4 +-- e2e/singleUse/tagFingerprint_test.go | 14 +++++----- e2e/singleUse/transmitFingerprint.go | 4 +-- e2e/singleUse/transmitFingerprint_test.go | 10 ++++--- e2e/singleUse/transmitKey.go | 4 +-- e2e/singleUse/transmitKey_test.go | 8 +++--- 14 files changed, 75 insertions(+), 52 deletions(-) diff --git a/e2e/singleUse/mac.go b/e2e/singleUse/mac.go index 7a3de99f..9b61361e 100644 --- a/e2e/singleUse/mac.go +++ b/e2e/singleUse/mac.go @@ -9,13 +9,13 @@ package singleUse import ( "bytes" - "gitlab.com/elixxir/crypto/hash" "crypto/hmac" + "gitlab.com/elixxir/crypto/hash" ) const macSalt = "singleUseMacSalt" -// MakeMAC generates the MAC used in both the transmission and response CMIX +// MakeMAC generates the MAC used in both the transmission and response cMix // messages. func MakeMAC(key []byte, encryptedPayload []byte) []byte { h := hmac.New(hash.DefaultHash, key) diff --git a/e2e/singleUse/mac_test.go b/e2e/singleUse/mac_test.go index 20979ed4..01f6a483 100644 --- a/e2e/singleUse/mac_test.go +++ b/e2e/singleUse/mac_test.go @@ -40,7 +40,7 @@ func TestMAC_Consistency(t *testing.T) { testMacBase64 := base64.StdEncoding.EncodeToString(testMAC) if expectedMac != testMacBase64 { - t.Errorf("MakeMAC() did not return the expected MAC (%d)."+ + t.Errorf("MakeMAC did not return the expected MAC (%d)."+ "\nexpected: %s\nreceived: %s", i, expectedMac, testMacBase64) } } @@ -67,7 +67,8 @@ func TestMAC_Unique(t *testing.T) { testMACBase64 := base64.StdEncoding.EncodeToString(testMAC) if _, exists := MACs[testMACBase64]; exists { - t.Errorf("Generated MAC collides with previously generated MAC (%d, %d)."+ + t.Errorf("Generated MAC collides with previously generated "+ + "MAC (%d, %d)."+ "\ncurrent MAC: key: %+v encryptedPayload: %+v"+ "\npreviouse MAC: key: %+v encryptedPayload: %+v"+ "\nMAC: %s", i, j, @@ -94,7 +95,8 @@ func TestMAC_Unique(t *testing.T) { testMACBase64 := base64.StdEncoding.EncodeToString(testMAC) if _, exists := MACs[testMACBase64]; exists { - t.Errorf("Generated MAC collides with previously generated MAC (%d, %d)."+ + t.Errorf("Generated MAC collides with previously generated "+ + "MAC (%d, %d)."+ "\ncurrent MAC: key: %+v encryptedPayload: %+v"+ "\npreviouse MAC: key: %+v encryptedPayload: %+v"+ "\nMAC: %s", i, j, @@ -137,7 +139,7 @@ func TestVerifyMAC(t *testing.T) { receivedMac, _ := base64.StdEncoding.DecodeString(expected) if !VerifyMAC(key, encryptedPayload, receivedMac) { - t.Errorf("VerifyMAC() failed for a correct MAC (%d)."+ + t.Errorf("VerifyMAC failed for a correct MAC (%d)."+ "\nkey: %+v\nexpected: %s\nreceived: %s", i, key, expected, testMACBase64) } @@ -161,7 +163,7 @@ func TestVerifyMAC_InvalidMacError(t *testing.T) { expectedMACBase64 := base64.StdEncoding.EncodeToString(expectedMac) if VerifyMAC(key, encryptedPayload, expectedMac) { - t.Errorf("VerifyMAC() verified invalid MAC (%d)."+ + t.Errorf("VerifyMAC verified invalid MAC (%d)."+ "\nkey: %+v\nexpected: %s\nreceived: %s", i, key, expectedMACBase64, testMACBase64) } diff --git a/e2e/singleUse/recipientID.go b/e2e/singleUse/recipientID.go index b2ec0af3..d679829d 100644 --- a/e2e/singleUse/recipientID.go +++ b/e2e/singleUse/recipientID.go @@ -22,8 +22,8 @@ func NewRecipientID(pubKey *cyclic.Int, unencryptedPayload []byte) *id.ID { // Create new hash h, err := hash.NewCMixHash() if err != nil { - jww.ERROR.Panicf("Failed to create new hash for single-use "+ - "communication recipient ID: %v", err) + jww.FATAL.Panicf("[SU] Failed to create new hash for single-use "+ + "communication recipient ID: %+v", err) } // Hash the public key and unencrypted payload diff --git a/e2e/singleUse/recipientID_test.go b/e2e/singleUse/recipientID_test.go index 1e03a1df..e7cf124e 100644 --- a/e2e/singleUse/recipientID_test.go +++ b/e2e/singleUse/recipientID_test.go @@ -25,7 +25,8 @@ func TestNewRecipientID_Consistency(t *testing.T) { prng := rand.New(rand.NewSource(42)) for i, expectedRID := range expectedRIDs { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) unencryptedPayload := make([]byte, prng.Intn(500)) prng.Read(unencryptedPayload) @@ -33,12 +34,12 @@ func TestNewRecipientID_Consistency(t *testing.T) { testRID := NewRecipientID(pubKey, unencryptedPayload) if expectedRID != testRID.String() { - t.Errorf("NewRecipientID() did not return the expected ID (%d)."+ + t.Errorf("NewRecipientID did not return the expected ID (%d)."+ "\nexpected: %s\nreceived: %s", i, expectedRID, testRID) } if testRID.GetType() != id.User { - t.Errorf("NewRecipientID() did not return expected ID type (%d)."+ + t.Errorf("NewRecipientID did not return expected ID type (%d)."+ "\nexpected: %s\nreceived: %s", i, id.User, testRID.GetType()) } } @@ -55,7 +56,8 @@ func TestNewRecipientID_Unique(t *testing.T) { // Test with same public key but differing payloads for i := 0; i < testRuns; i++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength+i, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength+i, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) for j := 0; j < testRuns; j++ { unencryptedPayload := make([]byte, prng.Intn(500)+j) @@ -64,12 +66,16 @@ func TestNewRecipientID_Unique(t *testing.T) { testID := NewRecipientID(pubKey, unencryptedPayload) if _, exists := IDs[testID]; exists { - t.Errorf("Generated ID collides with previously generated ID (%d, %d)."+ + t.Errorf("Generated ID collides with previously generated "+ + "ID (%d, %d)."+ "\ncurrent ID: key: %s unencryptedPayload: %+v"+ "\npreviouse ID: key: %s unencryptedPayload: %+v"+ "\nID: %s", i, j, - pubKey.Text(10), unencryptedPayload, IDs[testID].pubKey.Text(10), - IDs[testID].encryptedPayload, testID) + pubKey.Text(10), + unencryptedPayload, + IDs[testID].pubKey.Text(10), + IDs[testID].encryptedPayload, + testID) } else { IDs[testID] = struct { pubKey *cyclic.Int @@ -84,18 +90,23 @@ func TestNewRecipientID_Unique(t *testing.T) { unencryptedPayload := make([]byte, prng.Intn(500)+i) prng.Read(unencryptedPayload) for j := 0; j < testRuns; j++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength+j, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength+j, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) testID := NewRecipientID(pubKey, unencryptedPayload) if _, exists := IDs[testID]; exists { - t.Errorf("Generated ID collides with previously generated ID (%d, %d)."+ + t.Errorf("Generated ID collides with previously generated "+ + "ID (%d, %d)."+ "\ncurrent ID: key: %s unencryptedPayload: %+v"+ "\npreviouse ID: key: %s unencryptedPayload: %+v"+ "\nID: %s", i, j, - pubKey.Text(10), unencryptedPayload, IDs[testID].pubKey.Text(10), - IDs[testID].encryptedPayload, testID) + pubKey.Text(10), + unencryptedPayload, + IDs[testID].pubKey.Text(10), + IDs[testID].encryptedPayload, + testID) } else { IDs[testID] = struct { pubKey *cyclic.Int diff --git a/e2e/singleUse/responseFingerprint.go b/e2e/singleUse/responseFingerprint.go index 37f77266..911b013e 100644 --- a/e2e/singleUse/responseFingerprint.go +++ b/e2e/singleUse/responseFingerprint.go @@ -23,8 +23,8 @@ func NewResponseFingerprint(dhKey *cyclic.Int, keyNum uint64) format.Fingerprint // Create new hash h, err := hash.NewCMixHash() if err != nil { - jww.ERROR.Panicf("Failed to create new hash for single-use response "+ - "fingerprint: %v", err) + jww.FATAL.Panicf("[SU] Failed to create new hash for single-use "+ + "response fingerprint: %+v", err) } keyNumBytes := make([]byte, binary.MaxVarintLen64) diff --git a/e2e/singleUse/responseFingerprint_test.go b/e2e/singleUse/responseFingerprint_test.go index 7db2f95d..329b0da5 100644 --- a/e2e/singleUse/responseFingerprint_test.go +++ b/e2e/singleUse/responseFingerprint_test.go @@ -33,7 +33,8 @@ func TestNewResponseFingerprint_Consistency(t *testing.T) { prng := rand.New(rand.NewSource(42)) for i, expectedFP := range expectedFPs { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp()) @@ -41,7 +42,7 @@ func TestNewResponseFingerprint_Consistency(t *testing.T) { testFpBase64 := base64.StdEncoding.EncodeToString(testFP[:]) if expectedFP != testFpBase64 { - t.Errorf("NewResponseFingerprint() did not return the expected "+ + t.Errorf("NewResponseFingerprint did not return the expected "+ "fingerprint (%d).\nexpected: %s\nreceived: %s", i, expectedFP, testFpBase64) } @@ -59,7 +60,8 @@ func TestNewResponseFingerprint_Unique(t *testing.T) { // Test with same DH key but differing key numbers for i := 0; i < testRuns; i++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength+i, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength+i, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp()) for j := 0; j < testRuns; j++ { @@ -85,7 +87,8 @@ func TestNewResponseFingerprint_Unique(t *testing.T) { // Test with same key numbers but differing DH keys for i := 0; i < testRuns; i++ { for j := 0; j < testRuns; j++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength+j, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength+j, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp()) testFP := NewResponseFingerprint(dhKey, uint64(i)) diff --git a/e2e/singleUse/responseKey.go b/e2e/singleUse/responseKey.go index b5ada432..8f726da7 100644 --- a/e2e/singleUse/responseKey.go +++ b/e2e/singleUse/responseKey.go @@ -22,8 +22,8 @@ func NewResponseKey(dhKey *cyclic.Int, keyNum uint64) []byte { // Create new hash h, err := hash.NewCMixHash() if err != nil { - jww.ERROR.Panicf("Failed to create new hash for single-use response "+ - "key: %v", err) + jww.FATAL.Panicf( + "[SU] Failed to create new hash for single-use response key: %+v", err) } keyNumBytes := make([]byte, binary.MaxVarintLen64) diff --git a/e2e/singleUse/responseKey_test.go b/e2e/singleUse/responseKey_test.go index 5a981f97..e691b2c8 100644 --- a/e2e/singleUse/responseKey_test.go +++ b/e2e/singleUse/responseKey_test.go @@ -32,7 +32,8 @@ func TestNewResponseKey_Consistency(t *testing.T) { prng := rand.New(rand.NewSource(42)) for i, expectedKey := range expectedKeys { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp()) @@ -40,7 +41,7 @@ func TestNewResponseKey_Consistency(t *testing.T) { testKeyBase64 := base64.StdEncoding.EncodeToString(testKey) if expectedKey != testKeyBase64 { - t.Errorf("NewResponseKey() did not return the expected key (%d)."+ + t.Errorf("NewResponseKey did not return the expected key (%d)."+ "\nexpected: %s\nreceived: %s", i, expectedKey, testKeyBase64) } } @@ -57,7 +58,8 @@ func TestNewResponseKey_Unique(t *testing.T) { // Test with same DH key but differing key numbers for i := 0; i < testRuns; i++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength+i, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength+i, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp()) for j := 0; j < testRuns; j++ { @@ -84,7 +86,8 @@ func TestNewResponseKey_Unique(t *testing.T) { // Test with same key number but differing DH keys for i := 0; i < testRuns; i++ { for j := 0; j < testRuns; j++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength+j, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength+j, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp()) testKey := NewResponseKey(dhKey, uint64(i)) diff --git a/e2e/singleUse/tagFingerprint.go b/e2e/singleUse/tagFingerprint.go index ac450597..a5dad997 100644 --- a/e2e/singleUse/tagFingerprint.go +++ b/e2e/singleUse/tagFingerprint.go @@ -25,8 +25,8 @@ func NewTagFP(tag string) TagFP { // Create new hash h, err := hash.NewCMixHash() if err != nil { - jww.ERROR.Panicf("Failed to create new hash for single-use "+ - "communication tag fingerprint: %v", err) + jww.FATAL.Panicf("[SU] Failed to create new hash for single-use "+ + "communication tag fingerprint: %+v", err) } // Hash tag and salt diff --git a/e2e/singleUse/tagFingerprint_test.go b/e2e/singleUse/tagFingerprint_test.go index 7e6289b2..5fb029ee 100644 --- a/e2e/singleUse/tagFingerprint_test.go +++ b/e2e/singleUse/tagFingerprint_test.go @@ -37,7 +37,7 @@ func TestNewTagFP_Consistency(t *testing.T) { testFP := NewTagFP(string(tag)) if expectedFP != testFP.String() { - t.Errorf("NewTagFP() did not return the expected fingerprint (%d)."+ + t.Errorf("NewTagFP did not return the expected fingerprint (%d)."+ "\nexpected: %s\nreceived: %s", i, expectedFP, testFP) } } @@ -74,14 +74,14 @@ func TestUnmarshalTagFP(t *testing.T) { fp := UnmarshalTagFP(fpBytes) if !bytes.Equal(fpBytes, fp[:]) { - t.Errorf("UnmarshalTagFP() failed to copy the correct bytes into the tag "+ - "fingerprint.\nexpected: %+v\nreceived: %+v", fpBytes, fp) + t.Errorf("UnmarshalTagFP failed to copy the correct bytes into the "+ + "tag fingerprint.\nexpected: %+v\nreceived: %+v", fpBytes, fp) } // Ensure that the data is copied fpBytes[2]++ if fp[2] == fpBytes[2] { - t.Errorf("UnmarshalTagFP() failed to create a copy of the data.") + t.Errorf("UnmarshalTagFP failed to create a copy of the data.") } } @@ -94,14 +94,14 @@ func TestTagFP_Bytes(t *testing.T) { fp := UnmarshalTagFP(fpBytes) testFpBytes := fp.Bytes() if !bytes.Equal(fpBytes, testFpBytes) { - t.Errorf("Bytes() failed to return the expected bytes."+ + t.Errorf("Bytes failed to return the expected bytes."+ "\nexpected: %+v\nreceived: %+v", fpBytes, testFpBytes) } // Ensure that the data is copied testFpBytes[2]++ if fp[2] == testFpBytes[2] { - t.Errorf("Bytes() failed to create a copy of the data.") + t.Errorf("Bytes failed to create a copy of the data.") } } @@ -114,7 +114,7 @@ func TestTagFP_String(t *testing.T) { expectedString := base64.StdEncoding.EncodeToString(fpBytes) if expectedString != fp.String() { - t.Errorf("String() failed to return the expected string."+ + t.Errorf("String failed to return the expected string."+ "\nexpected: %s\nreceived: %s", expectedString, fp.String()) } } diff --git a/e2e/singleUse/transmitFingerprint.go b/e2e/singleUse/transmitFingerprint.go index 3969e42d..856de645 100644 --- a/e2e/singleUse/transmitFingerprint.go +++ b/e2e/singleUse/transmitFingerprint.go @@ -22,8 +22,8 @@ func NewTransmitFingerprint(pubKey *cyclic.Int) format.Fingerprint { // Create new hash h, err := hash.NewCMixHash() if err != nil { - jww.ERROR.Panicf("Failed to create new hash for single-use "+ - "transmission fingerprint: %v", err) + jww.FATAL.Panicf("[SU] Failed to create new hash for single-use "+ + "transmission fingerprint: %+v", err) } // Hash the public key and salt diff --git a/e2e/singleUse/transmitFingerprint_test.go b/e2e/singleUse/transmitFingerprint_test.go index 3d4676ea..1525196b 100644 --- a/e2e/singleUse/transmitFingerprint_test.go +++ b/e2e/singleUse/transmitFingerprint_test.go @@ -33,14 +33,15 @@ func TestNewTransmitFingerprint_Consistency(t *testing.T) { prng := rand.New(rand.NewSource(42)) for i, expectedFP := range expectedFPs { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) testFP := NewTransmitFingerprint(pubKey) testFpBase64 := base64.StdEncoding.EncodeToString(testFP[:]) if expectedFP != testFpBase64 { - t.Errorf("NewTransmitFingerprint() did not return the expected "+ + t.Errorf("NewTransmitFingerprint did not return the expected "+ "fingerprint (%d).\nexpected: %s\nreceived: %s", i, expectedFP, testFpBase64) } @@ -54,12 +55,13 @@ func TestNewTransmitFingerprint_Unique(t *testing.T) { FPs := make(map[format.Fingerprint]*cyclic.Int) for i := 0; i < testRuns; i++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) testFP := NewTransmitFingerprint(pubKey) if FPs[testFP] != nil { - t.Errorf("Generated fingerprint from key %s collides with "+ + t.Errorf("generated fingerprint from key %s collides with "+ "previously generated fingerprint from key %s."+ "\nfingerprint: %s", pubKey.Text(10), FPs[testFP].Text(10), testFP) diff --git a/e2e/singleUse/transmitKey.go b/e2e/singleUse/transmitKey.go index 038b75ef..d8516165 100644 --- a/e2e/singleUse/transmitKey.go +++ b/e2e/singleUse/transmitKey.go @@ -20,8 +20,8 @@ func NewTransmitKey(dhKey *cyclic.Int) []byte { // Create new hash h, err := hash.NewCMixHash() if err != nil { - jww.ERROR.Panicf("Failed to create new hash for single-use "+ - "communication transmission key: %v", err) + jww.FATAL.Panicf("[SU] Failed to create new hash for single-use "+ + "communication transmission key: %+v", err) } // Hash the DH key and salt diff --git a/e2e/singleUse/transmitKey_test.go b/e2e/singleUse/transmitKey_test.go index 52f182a8..d6c5b9df 100644 --- a/e2e/singleUse/transmitKey_test.go +++ b/e2e/singleUse/transmitKey_test.go @@ -32,7 +32,8 @@ func TestNewTransmitKey_Consistency(t *testing.T) { prng := rand.New(rand.NewSource(42)) for i, expectedKey := range expectedKeys { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp()) @@ -40,7 +41,7 @@ func TestNewTransmitKey_Consistency(t *testing.T) { testKeyBase64 := base64.StdEncoding.EncodeToString(testKey) if expectedKey != testKeyBase64 { - t.Errorf("NewTransmitKey() did not return the expected key (%d)."+ + t.Errorf("NewTransmitKey did not return the expected key (%d)."+ "\nexpected: %s\nreceived: %s", i, expectedKey, testKeyBase64) } } @@ -53,7 +54,8 @@ func TestNewTransmitKey_Unique(t *testing.T) { keys := make(map[string]*cyclic.Int, 100) for i := 0; i < testRuns; i++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp()) -- GitLab