|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.novell.nds.dirxml.shimhost.Password
public class Password
Encapsulation of common password behavior needed by other classes in this package.
Field Summary | |
---|---|
protected boolean |
modified
|
static String |
TAG_PASSWORD
Default tag name for XML element enclosing password data |
static char |
ZERO_CHAR
Convenience value: '' |
Constructor Summary | |
---|---|
Password()
Create an empty Password instance. |
|
Password(char[] plainPassword)
Create a Password instance with the passed plain password value and a default tag name of "password". |
|
Password(char[] plainPassword,
char[] pwdPassword)
Create a Password instance with the passed plain password value and a default tag name of "password". |
|
Password(Element pwdElement,
boolean secure)
Construct a Password instance from an Element containing password data. |
|
Password(Node parent,
boolean secure)
Construct a Password instance from a <password> element. |
|
Password(Node parent,
String tagName,
boolean secure)
Construct a Password instance from an element with the passed tag name. |
Method Summary | |
---|---|
void |
clear()
Set the password to null . |
static void |
clearPassword(char[] passwordChars)
Convenience method to fill an array of characters with zero. |
protected void |
finalize()
Finalizer. |
char[] |
getPassword()
Get the plaintext password value from this instance. |
char[] |
getPassword(char[] pwdPassword)
Get the plaintext password value from this instance. |
String |
getTagName()
Get the tag name to use for XML representations of this instance. |
boolean |
hasBeenModified()
Return true if this instance has been modified. |
boolean |
isEmpty()
Return whether or not there is a non-empty password set. |
boolean |
isEmpty(char[] pwdPassword)
Return whether or not there is a non-empty password set. |
boolean |
isEncrypted()
Return true if the password associated with this instance is encrypted. |
void |
resetModified()
Reset the modified flag for this instance such that hasBeenModified()
will return false . |
void |
setEncrypted(char[] passwordPwd)
Encrypt the unencrypted password associated with this instance. |
void |
setPassword(byte[] passwordData)
Set encrypted password data for this instance. |
void |
setPassword(char[] password)
Set the plaintext password value for this instance. |
void |
setPassword(char[] password,
char[] passwordPwd)
Set an encrypted password for this instance. |
void |
setTagName(String tagName)
Set the tag name to use for XML representations of this instance |
void |
setUnencrypted(char[] passwordPwd)
Unencrypt the encryped password associated with this instance. |
Element |
toXML(Node parent)
Construct an XML representation of this Password instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String TAG_PASSWORD
public static final char ZERO_CHAR
protected boolean modified
Constructor Detail |
---|
public Password()
Password
instance.
public Password(char[] plainPassword)
plainPassword
- password characterspublic Password(char[] plainPassword, char[] pwdPassword) throws CipherException
plainPassword
- password characterspwdPassword
- password used to encrypt the plain password characters
CipherException
- if an error occurs while encrypting the
plaintext passwordpublic Password(Node parent, boolean secure) throws XMLException
parent
- Node with a <password> element childsecure
- true if the content of the <password> element is
base-64 encoded encrypted password data
XMLException
- if the XML data is incorrectpublic Password(Node parent, String tagName, boolean secure) throws XMLException
parent
- Node with an element child containing password datatagName
- name of element containing password datasecure
- true if the content of the <password> element is
base-64 encoded encrypted password data
XMLException
- if the XML data is incorrectpublic Password(Element pwdElement, boolean secure) throws IllegalArgumentException, XMLException
pwdElement
- Element containing password datasecure
- true if the content of the <password> element is
base-64 encoded encrypted password data
XMLException
- if the XML data is incorrect
IllegalArgumentException
- if pwdElement is nullMethod Detail |
---|
public boolean hasBeenModified()
true
if this instance has been modified.
The instance is considered to have been modified if a change was made that affects the persistent representation since:
resetModified()
was last called
hasBeenModified
in interface ConfigElement
true
or false
resetModified()
,
toXML(org.w3c.dom.Node)
public void resetModified()
hasBeenModified()
will return false
.
resetModified
in interface ConfigElement
hasBeenModified()
public static void clearPassword(char[] passwordChars)
passwordChars
- char array to clearpublic Element toXML(Node parent)
Note that the act of creating an XML representation does not reset this instance's
modified flag. It must be reset by calling resetModified()
.
toXML
in interface ConfigElement
parent
- Node under which to construct XML representation
hasBeenModified()
,
resetModified()
public String getTagName()
public void setTagName(String tagName) throws IllegalArgumentException
tagName
- tag name
IllegalArgumentException
- if tagName
is null
, empty, or
doesn't match the XML Name productionpublic boolean isEmpty() throws IllegalStateException
This will return true
if no password is set, or the empty string
has been set.
true
if no password or empty string is password
IllegalStateException
- thrown if the password is encryptedpublic boolean isEmpty(char[] pwdPassword) throws CipherException
This will return true if no password is set, or the empty string has been set.
pwdPassword
- password value for decrypting the encrypted password
value for this instance.
true
if no password or empty string is password
CipherException
- thrown if an error occurs decrypting the passwordpublic void clear()
null
.
public char[] getPassword() throws IllegalStateException
IllegalStateException
- if the password is encrypted
(use getPassword(final char [] pwdPassword) insteadpublic char[] getPassword(char[] pwdPassword) throws CipherException
pwdPassword
- password value for decrypting the encrypted password
value for this instance.
CipherException
- if an error occurs decrypting the passwordpublic void setPassword(char[] password)
password
- the plaintext password characterspublic void setPassword(byte[] passwordData)
passwordData
- encrypted password data bytespublic void setPassword(char[] password, char[] passwordPwd) throws CipherException
password
- plaintext password characterspasswordPwd
- password with which to encrypt the plaintext password
CipherException
- if an error occurs while encrypting the plaintext
password value.public boolean isEncrypted()
public void setEncrypted(char[] passwordPwd) throws IllegalStateException, CipherException
passwordPwd
- password used to encrypt the password associated
with this instance.
IllegalStateException
- if password is already encrypted
CipherException
- if an error occurs while encrypting the plaintext
password value.public void setUnencrypted(char[] passwordPwd) throws CipherException
passwordPwd
- password needed to unencrypt the password associated
with this instance.
CipherException
- if an error occurs decrypting the passwordprotected void finalize()
finalize
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |