org.apache.fulcrum.jce.crypto
Class PasswordFactory
java.lang.Object
org.apache.fulcrum.jce.crypto.PasswordFactory
- All Implemented Interfaces:
- PasswordParameters
public class PasswordFactory
- extends java.lang.Object
- implements PasswordParameters
The implementation supplies a default password in the case that
the programmer don't want to have additional hassles. It is easy to
reengineer the password being used but much better than a hard-coded
password in the application.
The code uses parts from Markus Hahn's Blowfish library found at
http://blowfishj.sourceforge.net/
- Author:
- Siegfried Goeschl , Markus Hahn
Method Summary |
static char[] |
create()
|
static char[] |
create(char[] seed)
|
static char[] |
create(char[] password,
byte[] salt,
int count)
Creates a default password using "xxxx-xxxx-xxxx-xxxxx". |
static char[] |
create(java.lang.String seed)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PasswordFactory
public PasswordFactory()
create
public static final char[] create()
throws java.security.NoSuchAlgorithmException,
java.io.UnsupportedEncodingException
- Returns:
- a default password using "xxxx-xxxx-xxxx-xxxxx"
- Throws:
java.security.NoSuchAlgorithmException
java.io.UnsupportedEncodingException
create
public static final char[] create(java.lang.String seed)
throws java.security.NoSuchAlgorithmException,
java.io.UnsupportedEncodingException
- Parameters:
seed
- the default password supplied by the caller
- Returns:
- a password using "xxxx-xxxx-xxxx-xxxxx"
- Throws:
java.security.NoSuchAlgorithmException
java.io.UnsupportedEncodingException
create
public static final char[] create(char[] seed)
throws java.security.NoSuchAlgorithmException,
java.io.UnsupportedEncodingException
- Parameters:
seed
- the default password supplied by the caller
- Returns:
- a password using "xxxx-xxxx-xxxx-xxxxx"
- Throws:
java.security.NoSuchAlgorithmException
java.io.UnsupportedEncodingException
create
public static final char[] create(char[] password,
byte[] salt,
int count)
throws java.security.NoSuchAlgorithmException,
java.io.UnsupportedEncodingException
- Creates a default password using "xxxx-xxxx-xxxx-xxxxx".
- Parameters:
salt
- the password saltpassword
- the default passwordcount
- number of MessageDigest iterations
- Returns:
- the default password
- Throws:
java.security.NoSuchAlgorithmException
- the encryption algorithm is not supported
java.io.UnsupportedEncodingException
- the requested encoding is not supported
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.