public abstract class Password
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MSCAPI_STYLE
Password obfuscation using Microsoft Crypto API which is only available on
windows.
|
static java.lang.String |
NON_PORTABLE_PASSWORD
Alternative password style which is not portable across environments and
machines
|
static java.lang.String |
PORTABLE_PASSWORD
Standard password style which is portable across environments.
|
Constructor and Description |
---|
Password() |
Modifier and Type | Method and Description |
---|---|
static PasswordCodec |
create(java.lang.String type)
Create a password implementation of the specified type.
|
protected abstract PasswordCodec |
createCodec(java.lang.String type) |
static java.lang.String |
decode(java.lang.String encoded)
Convenience method to decrypt a password.
|
static java.lang.String |
encode(java.lang.String plain,
java.lang.String type)
Convenience method to encode a password.
|
static void |
main(java.lang.String[] argv) |
public static final java.lang.String MSCAPI_STYLE
Use of this means that the password is encrypted with the current username's private key and certificate.
public static final java.lang.String PORTABLE_PASSWORD
It is not considered especially secure, but is enough to stop casual interrogation
public static final java.lang.String NON_PORTABLE_PASSWORD
It is not considered especially secure, but is enough to stop casual interrogation
public static PasswordCodec create(java.lang.String type) throws PasswordException
type
- the typePasswordException
- wrapping other exceptions.MSCAPI_STYLE
,
NON_PORTABLE_PASSWORD
,
PORTABLE_PASSWORD
protected abstract PasswordCodec createCodec(java.lang.String type) throws PasswordException
PasswordException
public static java.lang.String decode(java.lang.String encoded) throws PasswordException
encoded
- the encrypted passwordPasswordException
public static java.lang.String encode(java.lang.String plain, java.lang.String type) throws PasswordException
plain
- the plain passwordtype
- the type of encryption to use.PasswordException
MSCAPI_STYLE
,
NON_PORTABLE_PASSWORD
,
PORTABLE_PASSWORD
public static void main(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception