Class SecureEraser
java.lang.Object
cloud.opencode.base.crypto.util.SecureEraser
Secure memory erasure utilities to prevent sensitive data leakage - Overwrites memory with zeros to prevent data recovery
安全内存擦除工具,防止敏感数据泄露 - 用零覆盖内存以防止数据恢复
Features | 主要功能:
- Secure memory erasure for sensitive data - 敏感数据的安全内存擦除
Usage Examples | 使用示例:
SecureEraser.erase(sensitiveBytes);
SecureEraser.erase(sensitiveChars);
Security | 安全性:
- Thread-safe: Yes - 线程安全: 是
- Null-safe: Partial - 空值安全: 部分
- Since:
- JDK 25, opencode-base-crypto V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic voiderase(byte[] data) Securely erase byte array by overwriting with zeros 通过用零覆盖来安全擦除字节数组static voiderase(char[] data) Securely erase char array by overwriting with zeros 通过用零覆盖来安全擦除字符数组static voiderase(int[] data) Securely erase int array by overwriting with zeros 通过用零覆盖来安全擦除整数数组static voiderase(long[] data) Securely erase long array by overwriting with zeros 通过用零覆盖来安全擦除长整数数组static voiderase(ByteBuffer buffer) Securely erase ByteBuffer by overwriting with zeros 通过用零覆盖来安全擦除ByteBuffer
-
Method Details
-
erase
public static void erase(byte[] data) Securely erase byte array by overwriting with zeros 通过用零覆盖来安全擦除字节数组This method overwrites the entire array with zeros to prevent sensitive data from remaining in memory. The array reference remains valid but all data is zeroed. 此方法用零覆盖整个数组,以防止敏感数据残留在内存中。数组引用保持有效,但所有数据都被清零。
- Parameters:
data- byte array to erase (can be null)
-
erase
public static void erase(char[] data) Securely erase char array by overwriting with zeros 通过用零覆盖来安全擦除字符数组This method is particularly important for erasing passwords and other sensitive character data that should not remain in memory. 此方法对于擦除密码和其他不应保留在内存中的敏感字符数据特别重要。
- Parameters:
data- char array to erase (can be null)
-
erase
Securely erase ByteBuffer by overwriting with zeros 通过用零覆盖来安全擦除ByteBufferThis method works with both direct and heap ByteBuffers. The buffer's position and limit are preserved. 此方法适用于直接和堆ByteBuffer。缓冲区的位置和限制被保留。
- Parameters:
buffer- ByteBuffer to erase (can be null)
-
erase
public static void erase(int[] data) Securely erase int array by overwriting with zeros 通过用零覆盖来安全擦除整数数组- Parameters:
data- int array to erase (can be null)
-
erase
public static void erase(long[] data) Securely erase long array by overwriting with zeros 通过用零覆盖来安全擦除长整数数组- Parameters:
data- long array to erase (can be null)
-