public static void eraseKey ( byte [ ] keyToErase ) { if ( keyToErase != null ) { SecureRandom random ; try { random = SecureRandom . getInstance ( "SHA1PRNG" ) ; random . nextBytes ( keyToErase ) ; } catch ( NoSuchAlgorithmException e ) { // never reached } } }
Overwrites the supplied byte array with RNG generated data which destroys the original contents .