一、官方流程说明
二、官方流程解析
1 : 发起方向接收方发送注册 HTTP POST 请求/VIID/System/Register。
2: 接收方向发送方发送响应401 Unauthorized, 并在响应的消息头 WWW-Authenticate 字段中给
出适合发送方的认证机制和参数。
3: 发起方重新向接收方发送注册 HTTP POST 请求, 在请求的 Authorization 字段给出信任书, 包
含认证信息。
4: 接收方对请求进行验证, 如果发起方身份合法, 向发起方发送成功响应200 OK, 如果身份不合
法则发送拒绝服务应答。
三、Regist消息解析
wireshark抓包分析:
HTTP消息头:Post消息+消息体(Json)
消息内容文本话:
[POST /VIID/System/Register HTTP/1.1
Host: 10.0.21.166:1400
Content-Type: application/VIID+JSON; charset=UTF-8
Accept: */*
User-Agent: Vision-Zenith, ChengDu
Accept-Encoding: gzip, deflate
Cache-Control: no-cache
Content-Length: 54
{"RegisterObject":{"DeviceID":"34078100001190001002"}}
四、Regist消息回复未认证
文本化:
HTTP/1.1 401 Unauthorized
Content-Type: text/plain
WWW-Authenticate: Digest realm="12312312315031231231", nonce="zWq5D1nFFUa71Ni9", opaque="BSTjT6ow+VLrnu4k", algorithm=MD5, qop="auth"
Date: Tue, 04 Jun 2024 01:45:47 GMT
Content-Length: 17
401 Unauthorized
五、认证再次注册
文本化:
POST /VIID/System/Register HTTP/1.1
Host: 10.0.21.166:1400
Content-Type: application/VIID+JSON; charset=UTF-8
Authorization: Digest username="34078100001190001002", realm="12312312315031231231", nonce="zWq5D1nFFUa71Ni9", uri="/VIID/System/Register", algorithm="MD5", qop=auth, nc=00000001, cnonce="0a4f113b", response="72ad0bd84ec2ff10acf0c310b3beab16", opaque="BSTjT6ow+VLrnu4k"
Accept: */*
User-Agent: Vision-Zenith, ChengDu
Accept-Encoding: gzip, deflate
Cache-Control: no-cache
Content-Length: 54
{"RegisterObject":{"DeviceID":"34078100001190001002"}}
六、注册成功返回
官方定义:
wireshark抓包:
文本化:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 04 Jun 2024 01:46:02 GMT
Content-Length: 153
{
"ResponseStatusObject":{
"Id":"34078100001190001002",
"StatusCode":0,
"RequestURL":"/VIID/System/Register",
"StatusString":"",
"LocalTime":"20240604094602"
}}