Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
number571 committed Oct 24, 2024
1 parent 4fdcab3 commit bf69c95
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ func (p *sClient) encryptWithParams(
var (
rand = random.NewRandom()
salt = rand.GetBytes(cSaltSize)
pkid = p.fPrivKey.GetPubKey().GetHasher().ToBytes()
pkey = p.fPrivKey.GetPubKey()
)

data := joiner.NewBytesJoiner32([][]byte{pMsg, rand.GetBytes(pPadd)})
hash := hashing.NewHMACHasher(salt, bytes.Join(
[][]byte{pkid, pRecv.GetHasher().ToBytes(), data},
[][]byte{pkey.ToBytes(), pRecv.ToBytes(), data},
[]byte{},
)).ToBytes()

Expand All @@ -107,7 +107,7 @@ func (p *sClient) encryptWithParams(
return message.NewMessage(
ct,
cipher.EncryptBytes(joiner.NewBytesJoiner32([][]byte{
pkid,
pkey.GetHasher().ToBytes(),
salt,
hash,
p.fPrivKey.GetDSAPrivKey().SignBytes(hash),
Expand Down Expand Up @@ -155,8 +155,8 @@ func (p *sClient) DecryptMessage(pMapPubKeys asymmetric.IMapPubKeys, pMsg []byte
// Validate received hash with generated hash.
check := hashing.NewHMACHasher(salt, bytes.Join(
[][]byte{
sPubKey.GetHasher().ToBytes(),
p.fPrivKey.GetPubKey().GetHasher().ToBytes(),
sPubKey.ToBytes(),
p.fPrivKey.GetPubKey().ToBytes(),
data,
},
[]byte{},
Expand Down
12 changes: 6 additions & 6 deletions test/result/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bf69c95

Please sign in to comment.