/*
服务端发送:
<challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">bm9uY2U9IjEyOTE2MjcyODIwOTg3MTg0MzYzIixxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz</challenge>
其中bm9uY2U9IjEyOTE2MjcyODIwOTg3MTg0MzYzIixxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz base64解码后是:
nonce="12916272820987184363",qop="auth",charset=utf-8,algorithm=md5-sess
*/
/*
客户端响应:
<response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9ImFhYWFhYSIsbm9uY2U9IjEyOTE2MjcyODIwOTg3MTg0MzYzIixjbm9uY2U9IkM2QUMvS1ZycWxaUFNLa3RmdmJXUWJvbTBSdUtTYXZXVHFuSzhPNzJYS3M9IixuYz0wMDAwMDAwMSxkaWdlc3QtdXJpPSJ4bXBwLzExMi43NC42Ny45MiIscW9wPWF1dGgscmVzcG9uc2U9MDc4NDNkZjNlMTQ0ZWRhOTY1ZjUzNWQzMzEyZTJhNzgsY2hhcnNldD11dGYtOA==</response>
base64解码:
username="aaaaaa",nonce="12916272820987184363",cnonce="C6AC/KVrqlZPSKktfvbWQbom0RuKSavWTqnK8O72XKs=",nc=00000001,digest-uri="xmpp/112.74.67.92",qop=auth,response=07843df3e144eda965f535d3312e2a78,charset=utf-8
username是用户名
nonce是上面服务端发过来的nonce
conce是客户端随机字串
nc 是8位长的16进制数字符串,统计客户端使用nonce发出请求的次数(包含当前请求),例示我们可以设为”00000001”,
digest-uri=“xmpp/hostname”
qop=auth
response 按下面的算法response()计算
*/
package main