Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 27403 - Should PBKDF2 be allowed on non-multiple of 8 lengths for consistency? #32

Closed
mwatson2 opened this issue May 23, 2016 · 4 comments
Labels

Comments

@mwatson2
Copy link
Collaborator

Bug 27403 from Bugzilla:

PBKDF2 throws an OperationError if length is not a multiple of 8 bits.

This seems inconsistent with deriveBits() for other algorithms, which simply truncate to the specified bit length (for instance ECDH and DH).

@jimsch
Copy link
Collaborator

jimsch commented Jun 6, 2016

Looking at RFC 2898 - the answer is no. PBKDF2 is defined as taking as input dkLen - intended length in octets of the derived key. This means that the algorithm itself says that odd numbers of bits are not supported.

@mwatson2
Copy link
Collaborator Author

mwatson2 commented Jun 8, 2016

@jimsch It would still be possible for us to call the RFC2898 algorithm with a dkLen = ceil( length / 8 ) and then truncate. Wouldn't this be more consistent with ECDH ?

@jimsch
Copy link
Collaborator

jimsch commented Jun 8, 2016

I would prefer to make this match the algorithm definition rather than try and make this consistent. If people need this they can do the truncation themselves. I am more than willing to have the inconsistency.

@mwatson2
Copy link
Collaborator Author

mwatson2 commented Jun 8, 2016

If there are no other comments, then I'll close this with no changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants