diff --git a/broadcast/symmetricClient.go b/broadcast/symmetricClient.go index 3f0c7104d5dcb905a54775fd0fe3b026c263d9cd..3b5b288df48fba737460625554e7e96b7733077f 100644 --- a/broadcast/symmetricClient.go +++ b/broadcast/symmetricClient.go @@ -15,7 +15,6 @@ import ( "gitlab.com/elixxir/client/cmix/message" crypto "gitlab.com/elixxir/crypto/broadcast" "gitlab.com/elixxir/crypto/fastRNG" - "gitlab.com/elixxir/crypto/hash" "gitlab.com/elixxir/primitives/format" "gitlab.com/xx_network/crypto/signature/rsa" "gitlab.com/xx_network/primitives/id" @@ -150,18 +149,10 @@ func (s *symmetricClient) Stop() { } func (s *symmetricClient) verifyID() bool { - h, err := hash.NewCMixHash() + gen, err := crypto.NewSymmetricID(s.channel.Name, s.channel.Description, s.channel.Salt, rsa.CreatePublicKeyPem(s.channel.RsaPubKey)) if err != nil { - jww.FATAL.Panicf("[verifyID] Failed to create cmix hash") + jww.FATAL.Panicf("[verifyID] Failed to generate verified channel ID") return false } - h.Write([]byte(s.channel.Name)) - h.Write([]byte(s.channel.Description)) - h.Write(s.channel.Salt) - h.Write(rsa.CreatePublicKeyPem(s.channel.RsaPubKey)) - ridBytes := h.Sum(nil) - gen := &id.ID{} - copy(gen[:], ridBytes) - gen.SetType(id.User) return s.channel.ReceptionID.Cmp(gen) } diff --git a/cmd/symmetric.go b/cmd/symmetric.go index 20505235b1bc6d3b9caea76f58ab7f727fdd2e5e..a2b9305939def37ab8dc9471e5cebf6432db80bf 100644 --- a/cmd/symmetric.go +++ b/cmd/symmetric.go @@ -10,9 +10,7 @@ import ( "gitlab.com/elixxir/client/cmix/identity/receptionID" "gitlab.com/elixxir/client/cmix/rounds" crypto "gitlab.com/elixxir/crypto/broadcast" - "gitlab.com/elixxir/crypto/hash" "gitlab.com/xx_network/crypto/signature/rsa" - "gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/utils" "os" "time" @@ -87,19 +85,10 @@ var symmetricCmd = &cobra.Command{ salt = []byte(viper.GetString("salt")) } - h, err := hash.NewCMixHash() + rid, err := crypto.NewSymmetricID(name, desc, salt, pubKeyBytes) if err != nil { } - h.Write([]byte(name)) - h.Write([]byte(desc)) - h.Write(salt) - h.Write(pubKeyBytes) - ridBytes := h.Sum(nil) - - rid := &id.ID{} - copy(rid[:], ridBytes) - rid.SetType(id.User) symmetric = &crypto.Symmetric{ ReceptionID: rid, diff --git a/go.mod b/go.mod index 5cc7bdbc98c27ad9aad0f873ef32a516cc24c9f8..c585f11ca854b5bacdfcba42273bc108aeb9ac1a 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/spf13/viper v1.7.1 gitlab.com/elixxir/bloomfilter v0.0.0-20211222005329-7d931ceead6f gitlab.com/elixxir/comms v0.0.4-0.20220323190139-9ed75f3a8b2c - gitlab.com/elixxir/crypto v0.0.7-0.20220425192911-a23209a58073 + gitlab.com/elixxir/crypto v0.0.7-0.20220505211405-8fa14777b7d2 gitlab.com/elixxir/ekv v0.1.7 gitlab.com/elixxir/primitives v0.0.3-0.20220330212736-cce83b5f948f gitlab.com/xx_network/comms v0.0.4-0.20220315161313-76acb14429ac diff --git a/go.sum b/go.sum index b2b24d4d75babae71f71578a773220de0cf06b99..cc12f52e1dfca60d348156074145e818b7c40bbf 100644 --- a/go.sum +++ b/go.sum @@ -317,6 +317,8 @@ gitlab.com/elixxir/crypto v0.0.7-0.20220425192754-f9f5ca6ad2eb h1:K10bnRhnZS6XFx gitlab.com/elixxir/crypto v0.0.7-0.20220425192754-f9f5ca6ad2eb/go.mod h1:JkByWX/TXCjdu6pRJsx+jwttbBGvlAljYSJMImDmt+4= gitlab.com/elixxir/crypto v0.0.7-0.20220425192911-a23209a58073 h1:T0BK30t1F9M8RCdsuMN1bL34fSLNPqjqC+oufnjPh3I= gitlab.com/elixxir/crypto v0.0.7-0.20220425192911-a23209a58073/go.mod h1:JkByWX/TXCjdu6pRJsx+jwttbBGvlAljYSJMImDmt+4= +gitlab.com/elixxir/crypto v0.0.7-0.20220505211405-8fa14777b7d2 h1:RGcIOfppyuhTQvxGFCVTdF6S28HwZyUukh8MkEi3ydo= +gitlab.com/elixxir/crypto v0.0.7-0.20220505211405-8fa14777b7d2/go.mod h1:JkByWX/TXCjdu6pRJsx+jwttbBGvlAljYSJMImDmt+4= gitlab.com/elixxir/ekv v0.1.6 h1:M2hUSNhH/ChxDd+s8xBqSEKgoPtmE6hOEBqQ73KbN6A= gitlab.com/elixxir/ekv v0.1.6/go.mod h1:e6WPUt97taFZe5PFLPb1Dupk7tqmDCTQu1kkstqJvw4= gitlab.com/elixxir/ekv v0.1.7 h1:OW2z+N4QCqqMFzouAwFTWWMKz0Y/PDhyYReN7gQ5NiQ=