[security-dev] SHA salted passwords

Shane Bryzak sbryzak at redhat.com
Thu Jan 10 15:08:13 EST 2013


That shouldn't be too hard, we just need to amend the 
PasswordCredentialHandler by adding String to the list of supported 
credential types, i.e:

@SupportsCredentials({ UsernamePasswordCredentials.class, 
Password.class, String.class })

Then we need to add support for String credentials to the update() method.

On 10/01/13 04:00, Anil Saldhana wrote:
> Since the IdentityManager.updateCredential method expects a credential 
> of Object type, it is legal to use a String as credential.  I think 
> the implementation should be aware of cases when developers just plug 
> in a string value. The internal magic needs to happen to convert the 
> String to any object representation desired.
>
> On 01/07/2013 10:38 AM, Anil Saldhana wrote:
>> I don't think so. If certificates etc are used, they can be separate 
>> fields in the DB table.
>>
>> As guidance, let us look at ldap servers.  LDAP SDK/JNDI API allow 
>> bind and update of userPassword (standard ldap schema attribute).  
>> Security of the passwords is done by the ldap servers. The API is 
>> ignorant of the mechanisms used.
>>
>> In the case of DB servers, the IDM will have to do all the plumbing 
>> to secure the passwords and cannot rely on DB security. Given this, I 
>> think we should let developers just deal with password and the 
>> underlying plugged mechanisms of IDM can handle salting/hashing, 
>> bcrypt, encryption etc.
>>
>> Most of the developers will probably use the default 
>> encoding/masking/salting password mechanism IDM will ship with.  
>> Advanced developers should be able to plug in their favorite schemes 
>> if they desire.
>>
>> On 01/07/2013 10:32 AM, Shane Bryzak wrote:
>>> I've got no problem with that...are there any other types of 
>>> passwords besides text passwords anyway?
>>>
>>> On 08/01/13 02:28, Anil Saldhana wrote:
>>>> Why not just drop "PlainText" from the class name and keep it 
>>>> Password?  Most of the passwords are character based. If we are 
>>>> going to call it PlainTextPassword, irrespective of pluggable 
>>>> encoding/masking functionality under the covers, it will send 
>>>> jitters in developers' spines.
>>>>
>>>> On 01/07/2013 09:57 AM, Shane Bryzak wrote:
>>>>> It's actually currently a unique salt per account, but we need to 
>>>>> change it to unique salt per password (see getSalt() method in 
>>>>> [1]). I'm also -1 for EncodedPassword, as it doesn't fit the 
>>>>> design of the credential handler SPI.  What we probably really 
>>>>> need is an EncodedPasswordCredentialHandler, similar to [1] which 
>>>>> will manage the persistence of a PlainTextPassword however provide 
>>>>> a pluggable mechanism for controlling the encoding process.  This 
>>>>> will require some additional changes though to the SPI to support 
>>>>> overriding the default credential handlers  (not a major problem 
>>>>> though).
>>>>>
>>>>> [1] 
>>>>> https://github.com/picketlink/picketlink/blob/master/idm/impl/src/main/java/org/picketlink/idm/credential/internal/PlainTextPasswordCredentialHandler.java
>>>>>
>>>>> On 08/01/13 01:35, Anil Saldhana wrote:
>>>>>> Unique salt per password and hashed. This is the default scheme 
>>>>>> we plan to use when users just send plain text passwords to IDM. 
>>>>>> The EncodedPassword type will have pluggable mechanisms that can 
>>>>>> vary in security (including encryption).
>>>>>>
>>>>>> On 01/07/2013 09:33 AM, Jason Porter wrote:
>>>>>>> I haven't looked at the code yet, so forgive me if this is ignorance on my part. Are we using the same salt for every password? I think it might actually be a good idea to remove hashed passwords as an option and instead offer things more secure such as bcrypt or scrypt. One of those at least, imo, should be default. Hashed passwords, even with a salt are really not that secure and I'm not talking about rainbow table attacks, just plain brute force attacks with small box lots of GPU power and some coda code are quickly become the norm for brute forcing passwords.
>>>>>>>
>>>>>>> This also brings up a good point with what are our recommendations and defaults? Encryption, hashing, account locks?
>>>>>>>
>>>>>>> Sent from my iPhone
>>>>>>>
>>>>>>> On Jan 7, 2013, at 8:27, Pedro Igor Silva<psilva at redhat.com>  wrote:
>>>>>>>
>>>>>>>> >+1
>>>>>>>> >
>>>>>>>> >----- Original Message -----
>>>>>>>> >From: "Bruno Oliveira"<bruno at abstractj.org>
>>>>>>>> >To: "Anil Saldhana"<Anil.Saldhana at redhat.com>
>>>>>>>> >Cc:security-dev at lists.jboss.org
>>>>>>>> >Sent: Monday, January 7, 2013 12:58:01 PM
>>>>>>>> >Subject: Re: [security-dev] SHA salted passwords
>>>>>>>> >
>>>>>>>> >
>>>>>>>> >
>>>>>>>> >
>>>>>>>> >-- 
>>>>>>>> >"The measure of a man is what he does with power" - Plato
>>>>>>>> >-
>>>>>>>> >@abstractj
>>>>>>>> >-
>>>>>>>> >Volenti Nihil Difficile
>>>>>>>> >
>>>>>>>> >
>>>>>>>> >
>>>>>>>> >On Monday, January 7, 2013 at 12:18 PM, Anil Saldhana wrote:
>>>>>>>> >
>>>>>>>>> >>Having a PlainTextPassword and EncodedPassword separation at the class level is good. It clearly tells the user/developer what type of password is being stored. But if he chooses PTP, should we do the default salting/hashing in the background? The EncodedPassword can allow configuration of salting/hashing mechanisms.
>>>>>>>>> >>
>>>>>>>>> >>We should not at any cost save plain text passwords in the tables.
>>>>>>>> >+1 and maybe for a while we could refactor PlainTextPassword to EncodedPassword and avoid some misunderstanding.
>>>>>>>> >
>>>>>>>> >Makes sense?
>>>>>>>>> >>
>>>>>>>>> >>Wdyt?
>>>>>>>>> >>
>>>>>>>>> >>
>>>>>>>>> >>On 01/07/2013 08:14 AM, Pedro Igor Silva wrote:
>>>>>>>>>> >>>Yeah, the class name is not good and leads to confusion. Today you do not need any extra code to get encoded passwords. The code you pointed out is already doing that:https://github.com/picketlink/TODO/blob/master/server/src/main/java/org/aerogear/todo/server/security/register/RegistrationEndpoint.java#L85  Behind the scenes it is using SHA-512 and a SecureRandom-1024 salt. Unfortunately, you can not change such configuration for now. Regards. Pedro Igor ----- Original Message ----- From: "Bruno Oliveira"<bruno at abstractj.org>  (mailto:bruno at abstractj.org) To: "Pedro Igor Silva"<psilva at redhat.com>  (mailto:psilva at redhat.com) Cc:security-dev at lists.jboss.org  (mailto:security-dev at lists.jboss.org) Sent: Monday, January 7, 2013 11:49:08 AM Subject: Re: [security-dev] SHA salted passwords Hi Pedro, maybe the class name led me to some confusion and I missed the real concept here. So, the PlainTextPassword can be used to store encoded password which algorithm will be used behind!
>>>>>>>> >  the scen
>>>>>>>> >es? Which extra code is necessary to have encoded passwords on PicketLink? Could you please provide some example? +1 on EncodedPassword class.
>>>>>>>>>> >>>-- "The measure of a man is what he does with power" - Plato - @abstractj - Volenti Nihil Difficile On Monday, January 7, 2013 at 10:20 AM, Pedro Igor Silva wrote:
>>>>>>>>>> >>>
>>>>>>>>>>>> >>>>>Actually, passwords are not stored in plain text by default. The PlainTextPassword is used to store both encoded and plain text passwords. > > Maybe we can change the API to better indicate whether you want to use encoded passwords or not. Something like this: > > Encoded : this.identityManager.updateCredential(user, new EncodedPassword(request.getPassword())); > > Plain Text: this.identityManager.updateCredential(user, new PlainTextPassword(request.getPassword())); > > Where for the EncodedPassword type you can specify the different configurations for the encoding such as supported algorithms, salt, etc. > > ----- Original Message ----- > From: "Bruno Oliveira"<bruno at abstractj.org (mailto:bruno at abstractj.org)>  (mailto:bruno at abstractj.org%28mailto:bruno at abstractj.org%29) > To:security-dev at lists.jboss.org  (mailto:security-dev at lists.jboss.org) (mailto:security-dev at lists.jboss.org) > Sent: Monday, January 7, 2013 7:49:58 AM > Subject: [security-dev] SHA salted passwor!
>>>>>>>> >ds > > Go
>>>>>>>> >od morning everyone. > > I'm planning to upgrade AeroGear to PicketLink, looking at the examples looks like the passwords will be stored in plain text > (https://github.com/picketlink/TODO/blob/master/server/src/main/java/org/aerogear/todo/server/security/register/RegistrationEndpoint.java#L85). > > I was just wondering if ShaSaltedPasswordHash (https://github.com/picketlink/picketlink/blob/master/idm/impl/src/main/java/org/picketlink/idm/password/internal/SHASaltedPasswordHash.java#L13) > could replace !
>>>>>>>>   PlainTextP
>>>>>>>> assword in this example, because I don't want to provide examples to our users with passwords stored in plain text. > > Is it possible? > > > -- > "The measure of a man is what he does with power" - Plato > - > @abstractj > - > Volenti Nihil Difficile > > > > _______________________________________________ > security-dev mailing list >security-dev at lists.jboss.org  (mailto:security-dev at lists.jboss.org) (mailto:security-dev at lists.jboss.org) >https://lists.jboss.org!
>>>>>>>   /m!
>>>>>>>> >ailman/li
>>>>>>>> >stinfo/security-dev
>>>>>>>>>> >>>
>>>>>>>>>> >>>_______________________________________________ security-dev mailing listsecurity-dev at lists.jboss.org  (mailto:security-dev at lists.jboss.org)https://lists.jboss.org/mailman/listinfo/security-dev
>>>>>>>>>
>
>
> _______________________________________________
> security-dev mailing list
> security-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/security-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/security-dev/attachments/20130111/4645579a/attachment-0001.html 


More information about the security-dev mailing list