KeyStore.PasswordProtection

public static class KeyStore.PasswordProtection extends Object
implements KeyStore.ProtectionParameter Destroyable

A password-based implementation of ProtectionParameter.

Public Constructor Summary

KeyStore.PasswordProtection(char[] password)
Creates a password parameter.

Public Method Summary

synchronized void
destroy()
Clears the password.
synchronized char[]
getPassword()
Gets the password.
synchronized boolean
isDestroyed()
Determines if password has been cleared.

Inherited Method Summary

Public Constructors

public KeyStore.PasswordProtection (char[] password)

Creates a password parameter.

The specified password is cloned before it is stored in the new PasswordProtection object.

Parameters
password the password, which may be null

Public Methods

public synchronized void destroy ()

Clears the password.

Throws
DestroyFailedException if this method was unable to clear the password

public synchronized char[] getPassword ()

Gets the password.

Note that this method returns a reference to the password. If a clone of the array is created it is the caller's responsibility to zero out the password information after it is no longer needed.

Returns
  • the password, which may be null
Throws
IllegalStateException if the password has been cleared (destroyed)
See Also

public synchronized boolean isDestroyed ()

Determines if password has been cleared.

Returns
  • true if the password has been cleared, false otherwise