[jboss-jira] [JBoss JIRA] (ELY-1435) Elytron BCrypt Mapper Not Working with jBCrypt
Martin Choma (JIRA)
issues at jboss.org
Tue Nov 7 02:12:00 EST 2017
[ https://issues.jboss.org/browse/ELY-1435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13486573#comment-13486573 ]
Martin Choma commented on ELY-1435:
-----------------------------------
So if I understand correctly jBcrypt hash didn't work because it was stored in DB in modular crypt format. Whereas once columns are String-like in DB it is expected to be base64 format.
Would changing DB columns to Binary-like format type help so user can use modular crypt format?
{code:PasswordKeyMapper.java}
private static byte[] getBinaryColumn(ResultSetMetaData metaData, ResultSet resultSet, int column) throws SQLException {
if (column == -1) return null;
final int columnType = metaData.getColumnType(column);
switch (columnType) {
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY: {
return resultSet.getBytes(column);
}
case Types.CHAR:
case Types.LONGVARCHAR:
case Types.LONGNVARCHAR:
case Types.VARCHAR:
case Types.NVARCHAR: {
return CodePointIterator.ofString(resultSet.getString(column)).base64Decode().drain();
}
default: {
final Object object = resultSet.getObject(column);
if (object instanceof byte[]) {
return (byte[]) object;
} else if (object instanceof String) {
return CodePointIterator.ofString(resultSet.getString(column)).base64Decode().drain();
}
return null;
}
}
}
{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