how to 'Zero out' from memory an AES SecretKeySpec Key in Java
问题 I am using Java AES encryption using SecretKeySpec(byte[] key, String algorithm) to generate a Key object. After I encrypt something, I want to remove the Key from memory. I can remove all references to the Key, but that does not guarantee that the key is not floating somewhere in memory. I can "zero out" the byte[] array that I used to generate the Key, but how can I zero out or flush the actual Key memory. 回答1: There doesn't appear to be a way to do this in Java versions up to 7, but it has