[jboss-jira] [JBoss JIRA] (ELY-1435) Elytron BCrypt Mapper Not Working with jBCrypt
Paul Carroll (JIRA)
issues at jboss.org
Tue Nov 7 09:28:01 EST 2017
[ https://issues.jboss.org/browse/ELY-1435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13486848#comment-13486848 ]
Paul Carroll commented on ELY-1435:
-----------------------------------
Just want to let you know that I can use jBCrypt to store passwords if I do the following. I store elytronSalt in the SALT_VALUE column, elytronHash in the PASSWORD column and iterationCount in the ITERATION_COUNT column. Authentication succeeds using the <bcrypt-mapper> storing the values using the following code.
{code:java}
import java.util.Base64;
import java.util.Base64.Encoder;
import org.mindrot.jbcrypt.BCrypt;
import org.wildfly.security.password.interfaces.BCryptPassword;
import org.wildfly.security.password.util.ModularCrypt;
public static void main( String[] args )
{
try
{
int cost = 12;
String salt = BCrypt.gensalt( cost );
String hashedPassword = BCrypt.hashpw( clearPassword, salt );
BCryptPassword bcryptPassword = (BCryptPassword)ModularCrypt.decode( hashedPassword );
byte[] bcryptSalt = bcryptPassword.getSalt();
byte[] bcryptHash = bcryptPassword.getHash();
Encoder encoder = Base64.getEncoder();
String elytronSalt = encoder.encodeToString( bcryptSalt );
String elytronHash = encoder.encodeToString( bcryptHash );
int itertationCount = bcryptPassword.getIterationCount();
}
catch( Exception e )
{
e.printStackTrace();
}
}
{code}
> Elytron BCrypt Mapper Not Working with jBCrypt
> ----------------------------------------------
>
> Key: ELY-1435
> URL: https://issues.jboss.org/browse/ELY-1435
> Project: WildFly Elytron
> Issue Type: Bug
> Components: Passwords
> Affects Versions: 1.0.0.Final
> Environment: Wildfly 11.0.0.Final
> Windows Server 2008
> JDK 9.0.1
> Reporter: Paul Carroll
> Priority: Minor
>
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
More information about the jboss-jira
mailing list