net.sf.doolin.util
Class PasswordUtils

java.lang.Object
  extended by net.sf.doolin.util.PasswordUtils

public class PasswordUtils
extends Object

Utility methods for dealing with passwords.

Author:
Damien Coraboeuf

Method Summary
static char[] decodePassword(String s)
          Decodes a password from Base64
static String digestPassword(char[] password)
          Computes an encoded digest for a password
static String encodePassword(char[] password)
          Encodes a password using Base64
static String generateToken(int nChars)
          Generates an arbitrary token with nChars character length.
static boolean isBlankPassword(String encodedPassword)
          Is the password blank ?
static void main(String[] args)
          Program used to compute the digests of all password that are given on command line.
static byte[] passwordToBytes(char[] password)
          Converts a character password to a byte password using utf8
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

decodePassword

public static char[] decodePassword(String s)
Decodes a password from Base64

Parameters:
s - Encoded password
Returns:
Decoded password

digestPassword

public static String digestPassword(char[] password)
Computes an encoded digest for a password

Parameters:
password - Password to encode
Returns:
Digest for the password

encodePassword

public static String encodePassword(char[] password)
Encodes a password using Base64

Parameters:
password - Password to encode
Returns:
Encoded password

generateToken

public static String generateToken(int nChars)
Generates an arbitrary token with nChars character length.

Parameters:
nChars - Number of characters to generate
Returns:
Resulting string

isBlankPassword

public static boolean isBlankPassword(String encodedPassword)
Is the password blank ? This method uses the password with its encoded form.

Parameters:
encodedPassword - Encoded form of the password
Returns:
true if the underlying password is blank.

main

public static void main(String[] args)
Program used to compute the digests of all password that are given on command line.

Parameters:
args - List of passwords.

passwordToBytes

public static byte[] passwordToBytes(char[] password)
Converts a character password to a byte password using utf8

Parameters:
password - Password to convert
Returns:
Password as bytes


Copyright © 2011. All Rights Reserved.