From bcd01e0a3f974586fa4d249ad5df6da163e714bc Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Wed, 6 Mar 2024 14:16:19 -0700 Subject: [PATCH] WIP: verification: add log of master key Signed-off-by: Sumner Evans --- crypto/verificationhelper/reciprocate.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crypto/verificationhelper/reciprocate.go b/crypto/verificationhelper/reciprocate.go index ab177eb9..352931bb 100644 --- a/crypto/verificationhelper/reciprocate.go +++ b/crypto/verificationhelper/reciprocate.go @@ -9,6 +9,7 @@ package verificationhelper import ( "bytes" "context" + "encoding/base64" "fmt" "golang.org/x/exp/slices" @@ -60,8 +61,7 @@ func (vh *VerificationHelper) HandleScannedQRData(ctx context.Context, data []by } // Verify the master key is correct - crossSigningPubkeys := vh.mach.GetOwnCrossSigningPublicKeys(ctx) - if bytes.Equal(crossSigningPubkeys.MasterKey.Bytes(), qrCode.Key1[:]) { + if bytes.Equal(vh.mach.GetOwnCrossSigningPublicKeys(ctx).MasterKey.Bytes(), qrCode.Key1[:]) { log.Info().Msg("Verified that the other device has the same master key") } else { return fmt.Errorf("the master key does not match") @@ -100,6 +100,11 @@ func (vh *VerificationHelper) HandleScannedQRData(ctx context.Context, data []by } // Verify that what they think the master key is is correct. + log.Info(). + Stringer("master_key", vh.mach.GetOwnCrossSigningPublicKeys(ctx).MasterKey). + Str("key2", base64.StdEncoding.EncodeToString(qrCode.Key2[:])). + Msg("verifying master key") + if bytes.Equal(vh.mach.GetOwnCrossSigningPublicKeys(ctx).MasterKey.Bytes(), qrCode.Key2[:]) { log.Info().Msg("Verified that the other device has the correct master key") } else {