[keycloak-dev] Password storage and KDFs

Marek Posolda mposolda at redhat.com
Fri Jan 24 04:49:11 EST 2014


Hi Bruno,

that's great improvement. I just want to point the creation of 
SecureRandom during each password encoding/validation as it's platform 
dependent and quite expensive. We already have issues with this in 
GateIn. For example running this on my laptop:

     public static void main(String[] args) throws 
NoSuchAlgorithmException {
         SecureRandom.getInstance("SHA1PRNG").nextBytes(new byte[16]);
     }

is sometimes quick, but sometimes it took about 30 seconds to finish 
(depends on available random entropy from /dev/urandom on linux 
laptops). So IMO will be better to have it declared as static variable?

We already discussed and solved similar issue with picketlink team some 
time ago. In the end Picketlink is using SecureRandomProvider 
abstraction for retrieve SecureRandom instance. And default 
implementation of this interface is good compromise between security and 
performance.

Marek

On 22.1.2014 13:55, Bruno Oliveira wrote:
> Good morning guys, as a suggestion to improve the way how the passwords have been stored in nowadays I did some changes to support PBKDF2[1] (we have been doing the same thing on AeroGear for mobile devices), into this way is possible to prevent rainbow tables and brute force attacks like HashCat does for example.
>
> I'm completely fine on adding bcrypt as long as we include some KDF, I just didn't that because I would like to hear some feedback before move forward, not sure if makes sense but my suggestion is to remove SHA-* encoders because they can be easily broken and replace by the support for PBKDF2 and bcrypt only.
>
> What do you think? Let me know if I should move forward or that doesn't fit.
>
> [1] - https://github.com/keycloak/keycloak/pull/171
>
>



More information about the keycloak-dev mailing list