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

digest string in crypto.pbkdf2 #71

Open
fabioce opened this issue Feb 17, 2019 · 1 comment
Open

digest string in crypto.pbkdf2 #71

fabioce opened this issue Feb 17, 2019 · 1 comment

Comments

@fabioce
Copy link

fabioce commented Feb 17, 2019

I notice an error using the:
LambdAuthCreateUser

this piece of code:

crypto.pbkdf2(password, salt, iterations, len, function(err, derivedKey) {
if (err) return fn(err);
fn(null, salt, derivedKey.toString('base64'));
});

don't work if I don't add after len a digest string, for example null

crypto.pbkdf2(password, salt, iterations, len, null, function(err, derivedKey) {
if (err) return fn(err);
fn(null, salt, derivedKey.toString('base64'));
});

Is it just my problem?

@lmiguelmh
Copy link

According the Nodejs documentation for pbkdf2 function:

crypto.pbkdf2(password, salt, iterations, keylen, digest, callback)
[...]
If digest is null, 'sha1' will be used. This behavior is deprecated, please specify a digest explicitly.

So, I think the problem is that init.sh is specifying an old version of Nodejs and in new versions they changed the signature of pbkdf2 function.

LambdAuth/init.sh

Lines 140 to 145 in ef2e828

aws lambda create-function --function-name ${f} \
--runtime nodejs4.3 \
--role arn:aws:iam::"$AWS_ACCOUNT_ID":role/${f} \
--handler index.handler \
--zip-file fileb://${f}.zip \
--region $REGION

lmiguelmh added a commit to lmiguelmh/LambdAuth that referenced this issue Nov 10, 2019
lmiguelmh added a commit to lmiguelmh/LambdAuth that referenced this issue Nov 10, 2019
lmiguelmh added a commit to lmiguelmh/LambdAuth that referenced this issue Nov 10, 2019
lmiguelmh added a commit to lmiguelmh/LambdAuth that referenced this issue Nov 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants