我无法验证 OpenID 签名。这就是我所做的,请告诉我有什么问题:
这些是我在关联时得到的值:
mac_key 3E2FH8mCR/OJ3/T6N3UPqD8iYf0fXyQ0c4io5psTC7s=
assoc_handle AMlYA9WWc0Jk8BnTg9E0cvczK8DYBediGvu5snBaYec9uFlTj3wbY9ezQepX-kFv2foRGQC6
我将客户端重定向到:
https://www.google.com/accounts/o8/ud?openid.ns=http://specs.openid.net/auth/2.0&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&openid.return_to=http://www.sdfanq.com/checkauth&openid.realm=http://www.sdfanq.com/&openid.mode=checkid_setup&openid.assoc_handle=AMlYA9WWc0Jk8BnTg9E0cvczK8DYBediGvu5snBaYec9uFlTj3wbY9ezQepX-kFv2foRGQC6
Uppon accepting, the client is redirect back to:
http://www.sdfanq.com/checkauth?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=id_res&openid.op_endpoint=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fud&openid.response_nonce=2012-05-23T05%3A54%3A30Z0Sv8nDqIrrWYeQ&openid.return_to=http%3A%2F%2Fwww.sdfanq.com%2Fcheckauth&openid.assoc_handle=AMlYA9WWc0Jk8BnTg9E0cvczK8DYBediGvu5snBaYec9uFlTj3wbY9ezQepX-kFv2foRGQC6&openid.signed=op_endpoint%2Cclaimed_id%2Cidentity%2Creturn_to%2Cresponse_nonce%2Cassoc_handle&openid.sig=HtlEGDEmee1UsH9fZg%2BQXt3JCyk11Lb7RMTNEcxbCKo%3D&openid.identity=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawlUNTJm8YX2SyJ2QXsg9eBe3g0LNnKKXwY&openid.claimed_id=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawlUNTJm8YX2SyJ2QXsg9eBe3g0LNnKKXwY
To verify the signature I concatenate the keys like this:
op_endpoint:https://www.google.com/accounts/o8/ud\nclaimed_id:https://www.google.com/accounts/o8/id?id=AItOawlUNTJm8YX2SyJ2QXsg9eBe3g0LNnKKXwY\nidentity:https://www.google.com/accounts/o8/id?id=AItOawlUNTJm8YX2SyJ2QXsg9eBe3g0LNnKKXwY\nreturn_to:http://www.sdfanq.com/checkauth\nresponse_nonce:2012-05-23T05:54:30Z0Sv8nDqIrrWYeQ\nassoc_handle:AMlYA9WWc0Jk8BnTg9E0cvczK8DYBediGvu5snBaYec9uFlTj3wbY9ezQepX-kFv2foRGQC6\n
Now when I base64.encode(hmac256("3E2FH8mCR/OJ3/T6N3UPqD8iYf0fXyQ0c4io5psTC7s=", S)), where 'S' is the concatenated string, I get a wrong value.