intarsys runtime library

de.intarsys.tools.authenticate
Class PasswordTools

java.lang.Object
  extended by de.intarsys.tools.authenticate.PasswordTools

public class PasswordTools
extends Object

A tool class for handling passwords and authentication


Constructor Summary
PasswordTools()
           
 
Method Summary
static char[] createPassword(int length)
          Create a random password of length length.
static String createSalt(int length)
          Create a random salt of length length.
static String hash(String salt, char[] password)
          A one way hash for a clear text password.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PasswordTools

public PasswordTools()
Method Detail

createPassword

public static char[] createPassword(int length)
Create a random password of length length.

Parameters:
length -
Returns:
A new random password.

createSalt

public static String createSalt(int length)
Create a random salt of length length. The result is a String representing the Base64 encoded bytes.

Parameters:
length -
Returns:
A new random salt String, base 64 encoded.

hash

public static String hash(String salt,
                          char[] password)
A one way hash for a clear text password.

Parameters:
salt - A Base64 encoded salt value.
password - The clear text password
Returns:
A one way hash for a clear text password.

intarsys runtime library

Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.