GitHub user alasdairhodge opened a pull request:

    https://github.com/apache/incubator-brooklyn/pull/687

    Tweak PasswordHasher to avoid potentially misleading use of 
ByteBuffer.array()

    Using `ByteBuffer.array()` to convert a salted password to its constituent 
bytes frequently results in an indeterminate number of spurious bytes to be 
included, due to the fact that the buffer's raw backing array is usually larger 
than the space consumed just by the values written to it. This causes 
Brooklyn-generated hashes to deviate from the expected `sha256(salt + 
password)` values.
    
    Even though Brooklyn itself can generate hashes, it is desirable for the 
algorithm to be sufficiently predictable to permit generation by simple 
external mechanisms.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/alasdairhodge/incubator-brooklyn 
password-hash-bytearray-fix

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-brooklyn/pull/687.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #687
    
----
commit 599b239bd4cda0870acd36747189b1221c727e02
Author: Alasdair Hodge <[email protected]>
Date:   2015-06-11T12:03:53Z

    Tweak PasswordHasher.sha256() to avoid potentially misleading use of 
ByteBuffer.array().

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to