I have moved from node 4 to node 6 and this caused anything using the aws-sdk to return the following error message:
SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
Looking into the code this seems to be caused by my code calling crypto to create and validate hashes and sets
crypto.DEFAULT_ENCODING = 'binary'
If I change this from 'binary' to 'buffer' (which is the default) the aws-sdk works but my code cannot validate old hashes.
This is the code used to create and check the hashes:
crypto.pbkdf2(password, salt, iterations, keysize, function (err, derivedKey) {
callback(null, [salt.toString('base64'), new Buffer(derivedKey).toString('base64')])
});
Looking at the crypto documentation for crypto.DEFAULT_ENCODING I am not sure what the difference is between using buffer and binary.
Is there a way to use the binary encoding only for this crypto method and not affect the aws-sdk ?
If not is there a way of transforming a hash produced by pbkdf2 using 'buffer' encoding to what it would have produced if it was using the 'binary' encoding?