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
-
_algo
-
-
internalLayout
-
-
maximum_length
-
-
minimum_length
-
-
panel
-
-
StandardDefaultPassWord
-
-
PrefFieldPassWord()
- Constructor used by new Instance when internalizing this object.
-
PrefFieldPassWord(String, String)
- Constructor for password field with default constraints and password.
-
PrefFieldPassWord(String, String, String)
- Constructor for password field with default constraints.
-
PrefFieldPassWord(String, String, String, GridBagConstraints)
- Constructor for password field with guenuine constraints.
-
applyModification()
- Apply the change to the actual password value.
-
cancel()
- This method forget the user's changes.
-
getBytesValue()
- The same as Object getValue() but returning
an array of bytes directly.
-
getHashingFunction()
- Returns the selected hashing function.
-
getMessage()
- Returns the message that will be displayed when the password
is given by the user for the first time.
-
getValue()
- Returns the hashing value of the password.
-
isEqual(String)
- Returns true if this password has the same hashing value
than the one given as input.
-
isModified()
- Indicates of the user has changed the password.
-
isOK()
- Will check in the near future for the capability to change the password value.
-
myStreamSize()
- Returns the size of the stream that would hold the externalized form of this field.
-
readObject(StreamInputInterface)
- Internalizes this password field.
-
setHashingFunction(int)
- Set the hashing function h such that that passphrase
s is stored and tested with h(s).
-
setMessage(String)
- Sets the message explaining why this password is used.
-
setPassPhraseForChange(Object)
- Schedules a new passphrase.
-
setPassPhraseForChange(String)
- Same as setPassPhraseForChange(Object newval) but with a string
as argument.
-
setValue(Object)
- Sets the hashing value of the passphrase by specifying the
hashing value.
-
setValue(String)
- Sets the hashing value of the passphrase by specifying the passphrase
itself.
-
showme(PrefFrame)
- Shows the password button in a PrefFrame.
-
writeObject(StreamOutputInterface)
- Externalizes this password field.
_algo
public int _algo
panel
public PrefPanel panel
internalLayout
public FlowLayout internalLayout
StandardDefaultPassWord
public final static String StandardDefaultPassWord
minimum_length
public int minimum_length
maximum_length
public int maximum_length
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.
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.
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
PrefFieldPassWord
public PrefFieldPassWord()
- Constructor used by new Instance when internalizing this object.
Othwerwise, should not be used.
- Returns:
- the new empty field.
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:
-
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
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.
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.
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
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
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.
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
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
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
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.
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.
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
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
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
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
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
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
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