@Override public void destroy() throws DestroyFailedException { if (cipher instanceof Destroyable) ((Destroyable) cipher).destroy(); this.destroyed = true; }
@Override public void destroy() throws DestroyFailedException { if (cipher instanceof Destroyable) ((Destroyable) cipher).destroy(); this.destroyed = true; }
@Override public void destroy() { if (key instanceof Destroyable && !((Destroyable) key).isDestroyed()) { try { ((Destroyable) key).destroy(); } catch (DestroyFailedException e) { // it's too common that JCE keys aren't destroyable although they say they are // so won't log this to avoid spamming logs } } }
public boolean logout() throws LoginException { // Clear out the private state loginSucceeded = false; identity = null; if (sit != null) { if (!subject.isReadOnly()) { subject.getPrivateCredentials().remove(sit); } else { try { if (sit instanceof Destroyable) { // Try to destroy the credential try { ((Destroyable) sit).destroy(); } catch (Exception e) { throw new LoginException(); } } else { throw new LoginException(); } } finally { sit = null; } } } sit = null; return true; } }
key.destroy(); } catch (final DestroyFailedException e) {
/** * Attempts to destroy an object's data * * @param object Object to destroy */ public static void destroy(Object object) { if (object instanceof byte[]) { zero((byte[]) object); } else if (object instanceof char[]) { zero((char[]) object); } else if (object instanceof Destroyable) { ((Destroyable) object).destroy(); } else if (object instanceof javax.security.auth.Destroyable && !((javax.security.auth.Destroyable) object).isDestroyed()) { try { ((javax.security.auth.Destroyable) object).destroy(); } catch (DestroyFailedException e) { // JCE keys generally fail even then they pretend to be destroyable so don't log other those will spam } } }