org.xwiki.crypto.passwd
Interface PasswordVerificationFunction

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
DefaultPasswordVerificationFunction

public interface PasswordVerificationFunction
extends java.io.Serializable

Password verification function differes from key derivation function in that password verification function stores the hashed password given it. While this is quite wrong for encryption, it is exactly what is needed for verifying a password. Implementations are expected to wrap a key derivation function and store it's output.

Since:
2.5M1
Version:
$Id$

Method Summary
 void init(KeyDerivationFunction underlyingHashFunction, byte[] password)
          Initialize this function with the desired key length.
 boolean isPasswordCorrect(byte[] password)
          Validate a user supplied password.
 byte[] serialize()
          Store this function as a byte array so another function of the same class can be initialized with the same array and will then produce the same key for the given password.
 

Method Detail

init

void init(KeyDerivationFunction underlyingHashFunction,
          byte[] password)
Initialize this function with the desired key length.

Parameters:
underlyingHashFunction - the function which will be used when converting the password to a hash.
password - the user supplied password to be verified later.

serialize

byte[] serialize()
                 throws java.io.IOException
Store this function as a byte array so another function of the same class can be initialized with the same array and will then produce the same key for the given password.

Returns:
a byte array which can be used to recreate the same function again using init.
Throws:
java.io.IOException - if something fails within the serialization framework.

isPasswordCorrect

boolean isPasswordCorrect(byte[] password)
Validate a user supplied password.

Parameters:
password - the user supplied password.
Returns:
true if the hash of the password is the same as the stored hash.


Copyright © 2004-2011 XWiki. All Rights Reserved.