by java-man · 7y ago · 0 comments
example:
https://github.com/andy-goryachev/PasswordSafe/blob/master/s...
byte[] key = generateKey(); try { // sensitive operation } finally { Crypto.zero(key); }
once the operation finishes, the memory is cleared (and possibly subject to gc)
the problem is that some java classes, for instance BigInteger, are not designed for cryptographic operations - it's underlying arrays are not easily accessible (save for reflection).
A very good point, thank you.
What could be done to mitigate this? Direct ByteBuffer per
https://stackoverflow.com/questions/5670862/bytebuffer-alloc...
?