Class semper.preferences.PrefFieldPassWord
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class semper.preferences.PrefFieldPassWord

java.lang.Object
   |
   +----semper.preferences.PrefField
           |
           +----semper.preferences.PrefFieldPassWord

public class PrefFieldPassWord
extends PrefField
This class defines fields representing passwords. A password field appears as a button in preferences groups. Once the button is selected the user can change the passphrase in a different window. In order to do so, the user must show that he knows the actual value of the password.
Version:
$Revision: 1.6 $ $Date: 1997/01/29 15:36:32 $
Author:
Louis Salvail
See Also:
PrefFieldLabel, PrefFieldChoice, PrefFieldNegotiable, PrefFieldCheckBox, PrefFieldString

Variable Index

 o _algo
 o internalLayout
 o maximum_length
 o minimum_length
 o panel
 o StandardDefaultPassWord

Constructor Index

 o PrefFieldPassWord()
Constructor used by new Instance when internalizing this object.
 o PrefFieldPassWord(String, String)
Constructor for password field with default constraints and password.
 o PrefFieldPassWord(String, String, String)
Constructor for password field with default constraints.
 o PrefFieldPassWord(String, String, String, GridBagConstraints)
Constructor for password field with guenuine constraints.

Method Index

 o applyModification()
Apply the change to the actual password value.
 o cancel()
This method forget the user's changes.
 o getBytesValue()
The same as Object getValue() but returning an array of bytes directly.
 o getHashingFunction()
Returns the selected hashing function.
 o getMessage()
Returns the message that will be displayed when the password is given by the user for the first time.
 o getValue()
Returns the hashing value of the password.
 o isEqual(String)
Returns true if this password has the same hashing value than the one given as input.
 o isModified()
Indicates of the user has changed the password.
 o isOK()
Will check in the near future for the capability to change the password value.
 o myStreamSize()
Returns the size of the stream that would hold the externalized form of this field.
 o readObject(StreamInputInterface)
Internalizes this password field.
 o setHashingFunction(int)
Set the hashing function h such that that passphrase s is stored and tested with h(s).
 o setMessage(String)
Sets the message explaining why this password is used.
 o setPassPhraseForChange(Object)
Schedules a new passphrase.
 o setPassPhraseForChange(String)
Same as setPassPhraseForChange(Object newval) but with a string as argument.
 o setValue(Object)
Sets the hashing value of the passphrase by specifying the hashing value.
 o setValue(String)
Sets the hashing value of the passphrase by specifying the passphrase itself.
 o showme(PrefFrame)
Shows the password button in a PrefFrame.
 o writeObject(StreamOutputInterface)
Externalizes this password field.

Variables

 o _algo
  public int _algo
 o panel
  public PrefPanel panel
 o internalLayout
  public FlowLayout internalLayout
 o StandardDefaultPassWord
  public final static String StandardDefaultPassWord
 o minimum_length
  public int minimum_length
 o maximum_length
  public int maximum_length

Constructors

 o PrefFieldPassWord
  public PrefFieldPassWord(String passWordName,
                           String fieldName)
Constructor for password field with default constraints and password. The password is set initially to the StandardDefaultPassWord.
Parameters:
passWordName - is the name of that password which will appear on the button label in the preferences group.
fieldName - is the field name for this password. This is the string by which this field can be obtained by PrefGroup.get(fieldName).
Returns:
the new object.
 o PrefFieldPassWord
  public PrefFieldPassWord(String passWordName,
                           String fieldName,
                           String initialValue)
Constructor for password field with default constraints.
Parameters:
passWordName - is the name of that password which will appear on the button label in the preferences group.
fieldName - is the field name for this password. This is the string by which this field can be obtained by PrefGroup.get(fieldName).
initialValue - is the initial password string.
 o PrefFieldPassWord
  public PrefFieldPassWord(String passWordName,
                           String fieldName,
                           String initialValue,
                           GridBagConstraints constraints)
Constructor for password field with guenuine constraints. The passphrase is not set and then has still to be specified.
Parameters:
passWordName - is the name of that password and also the name of that field.
fieldName - is the field name for this password. This is the string by which this field can be obtained by PrefGroup.get(fieldName).
initialValue - is the initial password string.
constraints - is the set of GridBagConstraints for that component. The internal constraints representation is a clone of the input.
Returns:
the new object.
See Also:
GridBagConstraints
 o PrefFieldPassWord
  public PrefFieldPassWord()
Constructor used by new Instance when internalizing this object. Othwerwise, should not be used.
Returns:
the new empty field.

Methods

 o setHashingFunction
  public boolean setHashingFunction(int algo)
Set the hashing function h such that that passphrase s is stored and tested with h(s).
Parameters:
algo - is the hashing function to be used. This is according to the semper.crypto.CryptoConstants interface. Nothing is done if the paramater does not encode a valid hashing function.
Returns:
true if and only if the hashing function has been changed successfullly.
See Also:
 o getHashingFunction
  public int getHashingFunction()
Returns the selected hashing function.
Returns:
the integer encoding the hashing function according to the crypto manager constants.
See Also:
CryptoConstants
 o setMessage
  public void setMessage(String message)
Sets the message explaining why this password is used. The first time the password has to be given, this message will be displayed.
Parameters:
message - is the message to show. If the message is null nothing is done.
Returns:
none.
 o getMessage
  public String getMessage()
Returns the message that will be displayed when the password is given by the user for the first time.
Returns:
the message. If the message has not been set, the default message is returned.
 o showme
  public void showme(PrefFrame p)
Shows the password button in a PrefFrame.
Parameters:
p - is the frame where to put this field.
Returns:
none.
Overrides:
showme in class PrefField
 o getValue
  public Object getValue()
Returns the hashing value of the password. If the password has never been selected then the user is asked to supply one.
Returns:
the shadow of the password. Null is returned if the user did not give a correct passphrase.
Overrides:
getValue in class PrefField
 o getBytesValue
  public byte[] getBytesValue()
The same as Object getValue() but returning an array of bytes directly. If the password has never been selected then the user is asked to supply one.
Returns:
the shadow of the password stored in an array of bytes. Null is returned if the user did not give a correct passphrase.
 o setPassPhraseForChange
  protected byte[] setPassPhraseForChange(Object newval)
Schedules a new passphrase. The hashed value of the new passphrase will be recorded if and only if applyModification is called afterwards.
Parameters:
newval - is the passphrase itself. Must encode a string.
Returns:
none.
See Also:
applyModification
 o setPassPhraseForChange
  protected byte[] setPassPhraseForChange(String password) throws PreferencesException
Same as setPassPhraseForChange(Object newval) but with a string as argument. Used while the user is editing its preferences. Should not be used to set the preferences initially. In that case use setValue(.) instead.
Parameters:
password - is the new passphrase. The passphrase is not saved in this field, just the hashing value is accessible. The length must be greater then 0. If not then nothing is done.
Returns:
the new hashing value corresponding the given password.
See Also:
PrefPasswordButton
 o setValue
  public void setValue(Object passphrase)
Sets the hashing value of the passphrase by specifying the hashing value.
Parameters:
passphrase - is the password. The object must encode a String. If not then a runtime error will be thrown.
Returns:
none.
Overrides:
setValue in class PrefField
 o setValue
  public boolean setValue(String passphrase)
Sets the hashing value of the passphrase by specifying the passphrase itself.
Parameters:
password - is the passphrase itself.
Returns:
true if and only if the change has been preformed. For the time being it is always the case.
 o isEqual
  public boolean isEqual(String password)
Returns true if this password has the same hashing value than the one given as input.
Parameters:
password - is the string that is checked to have the same hashing value than this password. The length must be greater than 0.
Returns:
true if and only if the input passphrase has the same hashing value than this password. Returns false if the input password has length 0.
 o isModified
  public boolean isModified()
Indicates of the user has changed the password.
Returns:
true iff the value has been changed
Overrides:
isModified in class PrefField
 o applyModification
  public boolean applyModification()
Apply the change to the actual password value.
Returns:
true if and only if the modification occured.
Overrides:
applyModification in class PrefField
 o cancel
  public void cancel()
This method forget the user's changes. Returns to the state before the user try to change its password.
Returns:
none.
Overrides:
cancel in class PrefField
 o isOK
  public boolean isOK()
Will check in the near future for the capability to change the password value. For the time being (in a very insecure way), this method returns always true.
Returns:
true.
Overrides:
isOK in class PrefField
 o myStreamSize
  public int myStreamSize() throws StreamIOException
Returns the size of the stream that would hold the externalized form of this field.
Returns:
the size of the stream in bytes
Overrides:
myStreamSize in class PrefField
See Also:
Streamable
 o readObject
  public void readObject(StreamInputInterface stream) throws StreamIOException
Internalizes this password field.
Parameters:
stream - is the stream of data the object state is retrieved from
Returns:
none.
Overrides:
readObject in class PrefField
See Also:
Streamable
 o writeObject
  public void writeObject(StreamOutputInterface stream) throws StreamIOException
Externalizes this password field.
Parameters:
stream - is the stream of data the object state is recorded in
Returns:
none
Overrides:
writeObject in class PrefField
See Also:
Streamable

All Packages  Class Hierarchy  This Package  Previous  Next  Index