Skip to content

Commit

Permalink
Zero out previous key in native ChaCha20 cipher init
Browse files Browse the repository at this point in the history
  • Loading branch information
KostasTsiounis committed Oct 19, 2023
1 parent f215a7e commit 1d1ad7a
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 1d1ad7a

Please sign in to comment.