Skip to content

Commit

Permalink
Merge pull request #274 from KostasTsiounis/zero_out
Browse files Browse the repository at this point in the history
Zero out previous key in native ChaCha20 cipher init
  • Loading branch information
keithc-ca committed Nov 9, 2023
2 parents b336934 + 1d1ad7a commit 3dfae78
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,9 @@ private void init(int opmode, Key key, byte[] newNonce)
// assigning them to the object.
byte[] newKeyBytes = getEncodedKey(key);
checkKeyAndNonce(newKeyBytes, newNonce);
if (this.keyBytes != null) {
Arrays.fill(this.keyBytes, (byte)0);
}
this.keyBytes = newKeyBytes;
nonce = newNonce;

Expand Down

0 comments on commit 3dfae78

Please sign in to comment.