It seems like the crypto module in node returns buffer objects instead of binary strings as default since version 0.9.0.
This diff will fix the problem:
diff --git node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js
index 1431dd7..798f741 100644
--- node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js
+++ node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js
@@ -634,9 +634,9 @@ openid.associate = function(provider, callback, strict, algorithm)
if(algorithm.indexOf('no-encryption') === -1)
{
dh = _createDiffieHellmanKeyExchange(algorithm);
- params['openid.dh_modulus'] = _toBase64(dh.getPrime());
- params['openid.dh_gen'] = _toBase64(dh.getGenerator());
- params['openid.dh_consumer_public'] = _toBase64(dh.getPublicKey());
+ params['openid.dh_modulus'] = _toBase64(dh.getPrime("binary"));
+ params['openid.dh_gen'] = _toBase64(dh.getGenerator("binary"));
+ params['openid.dh_consumer_public'] = _toBase64(dh.getPublicKey("binary"));
}
_post(provider.endpoint, params, function(data, headers, statusCode)
@@ -713,10 +713,10 @@ openid.associate = function(provider, callback, strict, algorithm)
else
{
var serverPublic = _fromBase64(data.dh_server_public);
- var sharedSecret = convert.btwoc(dh.computeSecret(serverPublic));
+ var sharedSecret = convert.btwoc(dh.computeSecret(serverPublic, "binary", "binary"));
var hash = crypto.createHash(hashAlgorithm);
hash.update(sharedSecret);
- sharedSecret = hash.digest();
+ sharedSecret = hash.digest("binary");
var encMacKey = convert.base64.decode(data.enc_mac_key);
secret = convert.base64.encode(_xor(encMacKey, sharedSecret));
}