Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1014 → Rev 1015

/hostadmiral/trunk/src/ak/hostadmiral/core/model/PasswordStoreCrypt.java
0,0 → 1,33
package ak.hostadmiral.core.model;
 
import ak.hostadmiral.util.ModelException;
import ak.hostadmiral.util.DigestCrypt;
 
/**
*
* @hibernate.subclass discriminator-value="crypt"
*/
public class PasswordStoreCrypt
extends PasswordStoreAbstract
{
public PasswordStoreCrypt()
{
digest = "crypt";
}
 
protected String encode(String password)
throws ModelException
{
return DigestCrypt.crypt(password);
}
 
public boolean checkPassword(String password)
throws ModelException
{
if(this.password == null || this.password.length() < 3) return false;
 
String salt = this.password.substring(0, 2);
String crypted = DigestCrypt.crypt(salt, password);
return crypted.equals(this.password);
}
}