Skip to content

Commit

Permalink
Fix ecdh ephemeral key for curve25519
Browse files Browse the repository at this point in the history
Signed-off-by: Nguyen Van Nguyen <[email protected]>
  • Loading branch information
nguyennv committed Nov 27, 2024
1 parent f7052f4 commit 39e3053
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/src/packet/key/ecdh_session_key_params.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ class ECDHSessionKeyParams extends SessionKeyParams {
final privateKey = nacl.PrivateKey.fromSeed(
Helper.secureRandom().nextBytes(TweetNaCl.seedSize),
);
ephemeralKey = privateKey.publicKey.asTypedList.toBigIntWithSign(1);
ephemeralKey = Uint8List.fromList([
0x40,
...privateKey.publicKey.asTypedList,
]).toBigIntWithSign(1);
sharedKey = TweetNaCl.crypto_scalarmult(
Uint8List(TweetNaCl.sharedKeyLength),
privateKey.asTypedList,
Expand Down

0 comments on commit 39e3053

Please sign in to comment.