java.security
Class KeyStore.PasswordProtection

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.security.KeyStore.PasswordProtection
All Implemented Interfaces:
KeyStore.ProtectionParameter sample code for java.security.KeyStore.ProtectionParameter definition code for java.security.KeyStore.ProtectionParameter , Destroyable sample code for javax.security.auth.Destroyable definition code for javax.security.auth.Destroyable
Enclosing class:
KeyStore sample code for java.security.KeyStore definition code for java.security.KeyStore

public static class KeyStore.PasswordProtection
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements KeyStore.ProtectionParameter sample code for java.security.KeyStore.ProtectionParameter definition code for java.security.KeyStore.ProtectionParameter , Destroyable sample code for javax.security.auth.Destroyable definition code for javax.security.auth.Destroyable

A password-based implementation of ProtectionParameter.

Since:
1.5

Constructor Summary
KeyStore.PasswordProtection sample code for java.security.KeyStore.PasswordProtection.KeyStore.PasswordProtection(char[]) definition code for java.security.KeyStore.PasswordProtection.KeyStore.PasswordProtection(char[]) (char[] password)
          Creates a password parameter.
 
Method Summary
 void destroy sample code for java.security.KeyStore.PasswordProtection.destroy() definition code for java.security.KeyStore.PasswordProtection.destroy() ()
          Clears the password.
 char[] getPassword sample code for java.security.KeyStore.PasswordProtection.getPassword() definition code for java.security.KeyStore.PasswordProtection.getPassword() ()
          Gets the password.
 boolean isDestroyed sample code for java.security.KeyStore.PasswordProtection.isDestroyed() definition code for java.security.KeyStore.PasswordProtection.isDestroyed() ()
          Determines if password has been cleared.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

KeyStore.PasswordProtection sample code for java.security.KeyStore.PasswordProtection(char[]) definition code for java.security.KeyStore.PasswordProtection(char[])

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
Method Detail

getPassword sample code for java.security.KeyStore.PasswordProtection.getPassword() definition code for java.security.KeyStore.PasswordProtection.getPassword()

public 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 sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the password has been cleared (destroyed)
See Also:
destroy() sample code for java.security.KeyStore.PasswordProtection.destroy() definition code for java.security.KeyStore.PasswordProtection.destroy()

destroy sample code for java.security.KeyStore.PasswordProtection.destroy() definition code for java.security.KeyStore.PasswordProtection.destroy()

public void destroy()
             throws DestroyFailedException sample code for javax.security.auth.DestroyFailedException definition code for javax.security.auth.DestroyFailedException 
Clears the password.

Specified by:
destroy sample code for javax.security.auth.Destroyable.destroy() definition code for javax.security.auth.Destroyable.destroy() in interface Destroyable sample code for javax.security.auth.Destroyable definition code for javax.security.auth.Destroyable
Throws:
DestroyFailedException - if this method was unable to clear the password

isDestroyed sample code for java.security.KeyStore.PasswordProtection.isDestroyed() definition code for java.security.KeyStore.PasswordProtection.isDestroyed()

public boolean isDestroyed()
Determines if password has been cleared.

Specified by:
isDestroyed sample code for javax.security.auth.Destroyable.isDestroyed() definition code for javax.security.auth.Destroyable.isDestroyed() in interface Destroyable sample code for javax.security.auth.Destroyable definition code for javax.security.auth.Destroyable
Returns:
true if the password has been cleared, false otherwise