/** * Clears the password if it is in the cache, * and fires {@link PasswordCacheListener}s. */ public void clear() { synchronized(this) { if (password == null) return; Util.zeroOut(password); password = null; if (derivedKey != null) { derivedKey.clear(); derivedKey = null; } } for (PasswordCacheListener listener: cacheListeners) listener.passwordCleared(); }