clean method
Clears and releases the internal encryption key for ChaCha20-Poly1305 for security and memory management.
This method securely zeros and releases the internal encryption key used by the ChaCha20-Poly1305 instance to ensure that no sensitive key data is left in memory. It is an essential step for maintaining the security of the cipher instance after use.
Returns:
- The same ChaCha20Poly1305 instance after cleaning for method chaining.
Implementation
@override
ChaCha20Poly1305 clean() {
zero(_key); // Securely zero the encryption key
return this;
}