gnu.crypto.auth

Class Password

public final class Password extends ExpirableObject

Immutible, though destroyable, password class.

Extends ExpirableObject, implementing doDestroy() in which encapsulated char[], and byte[] password fields are cleared (elements set to zero) in order to thwart memory heap snooping.

Constructor Summary
Password(char[] password)
Create a new expirable Password object that will expire after the default timeout DEFAULT_TIMEOUT.
Password(char[] password, long delay)
Create a new expirable Password object that will expire after the timeout denoted by constructor parameter, delay.
Password(char[] password, int offset, int length)
Create a new expirable Password object that will expire after the default timeout DEFAULT_TIMEOUT.
Password(char[] password, int offset, int length, long delay)
Create a new expirable Password object that will expire after the timeout denoted by constructor parameter, delay.
Password(byte[] password)
Create a new expirable Password object that will expire after the default timeout DEFAULT_TIMEOUT.
Password(byte[] password, long delay)
Create a new expirable Password object that will expire after the timeout denoted by constructor parameter, delay.
Password(byte[] password, int offset, int length)
Create a new expirable Password object that will expire after the default timeout DEFAULT_TIMEOUT.
Password(byte[] password, int offset, int length, long delay)
Create a new expirable Password object that will expire after the timeout denoted by constructor parameter, delay.
Method Summary
protected voiddoDestroy()
Sets password field char[], and byte[] array elements to zero.
byte[]getBytes()
Returns a reference to the byte[] password storage field, bPassword.
char[]getPassword()
Returns a reference to the char[] password storage field, password.
booleanisDestroyed()
Returns true, or false relative to whether, or not this object's doDestroy() method has been called.

Constructor Detail

Password

public Password(char[] password)
Create a new expirable Password object that will expire after the default timeout DEFAULT_TIMEOUT.

Parameters: password The character array password to associate with this Password object.

Password

public Password(char[] password, long delay)
Create a new expirable Password object that will expire after the timeout denoted by constructor parameter, delay.

Parameters: password The character array password to associate with this Password object. delay The number of miliseconds before this Password object will be automatically destroyed.

Password

public Password(char[] password, int offset, int length)
Create a new expirable Password object that will expire after the default timeout DEFAULT_TIMEOUT.

Parameters: password The character array password to associate with this Password object. offset The password character array parameter element marking the beginning of the contained password string. length The number of characters, beginning at offset, to be copied into this object's password field.

Password

public Password(char[] password, int offset, int length, long delay)
Create a new expirable Password object that will expire after the timeout denoted by constructor parameter, delay.

Parameters: password The character array password to associate with this Password object. offset The password character array parameter element marking the beginning of the contained password string. length The number of characters, beginning at offset, to be copied into this object's password field. delay The number of miliseconds before this Password object will be automatically destroyed.

Password

public Password(byte[] password)
Create a new expirable Password object that will expire after the default timeout DEFAULT_TIMEOUT.

Parameters: password The byte array password to associate with this Password object.

Password

public Password(byte[] password, long delay)
Create a new expirable Password object that will expire after the timeout denoted by constructor parameter, delay.

Parameters: password The byte array password to associate with this Password object. delay The number of miliseconds before this Password object will be automatically destroyed.

Password

public Password(byte[] password, int offset, int length)
Create a new expirable Password object that will expire after the default timeout DEFAULT_TIMEOUT.

Parameters: password The byte array password to associate with this Password object. offset The password byte array parameter element marking the beginning of the contained password string. length The number of bytes, beginning at offset, to be copied into this object's password field.

Password

public Password(byte[] password, int offset, int length, long delay)
Create a new expirable Password object that will expire after the timeout denoted by constructor parameter, delay.

Parameters: password The byte array password to associate with this Password object. offset The password byte array parameter element marking the beginning of the contained password string. length The number of bytes, beginning at offset, to be copied into this object's bPassword field. delay The number of miliseconds before this Password object will be automatically destroyed.

Method Detail

doDestroy

protected void doDestroy()
Sets password field char[], and byte[] array elements to zero. This method implements base class ExpirableObject abstract method, doDestroy. See also, destroy.

getBytes

public byte[] getBytes()
Returns a reference to the byte[] password storage field, bPassword.

getPassword

public char[] getPassword()
Returns a reference to the char[] password storage field, password.

isDestroyed

public boolean isDestroyed()
Returns true, or false relative to whether, or not this object's doDestroy() method has been called. See also, {@ExpirableObject#destroy() }.
Copyright © 2001, 2002, 2003 Free Software Foundation, Inc. All Rights Reserved.