From e946a648cdfda8bd9bcff13d9da61b0de8987729 Mon Sep 17 00:00:00 2001 From: lawrencehj <1934378145@qq.com> Date: Thu, 26 Aug 2021 23:57:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=AE=BE=E5=A4=87=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E8=AE=A4=E8=AF=81=E6=97=B6=E9=AA=8C=E8=AF=81Response?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gb28181/auth/DigestServerAuthenticationHelper.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java index 234920e0..5ee3de69 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java @@ -194,12 +194,13 @@ public class DigestServerAuthenticationHelper { // 客户端随机数,这是一个不透明的字符串值,由客户端提供,并且客户端和服务器都会使用,以避免用明文文本。 // 这使得双方都可以查验对方的身份,并对消息的完整性提供一些保护 - //String cNonce = authHeader.getCNonce(); + String cnonce = authHeader.getCNonce(); // nonce计数器,是一个16进制的数值,表示同一nonce下客户端发送出请求的数量 int nc = authHeader.getNonceCount(); - String ncStr = new DecimalFormat("00000000").format(nc); -// String ncStr = new DecimalFormat("00000000").format(Integer.parseInt(nc + "", 16)); + String ncStr = String.format("%08x", nc).toUpperCase(); + // String ncStr = new DecimalFormat("00000000").format(nc); + // String ncStr = new DecimalFormat("00000000").format(Integer.parseInt(nc + "", 16)); String A1 = username + ":" + realm + ":" + pass; String A2 = request.getMethod().toUpperCase() + ":" + uri.toString(); @@ -212,7 +213,7 @@ public class DigestServerAuthenticationHelper { String HA2 = toHexString(mdbytes); logger.debug("HA1: " + HA1); logger.debug("HA2: " + HA2); - String cnonce = authHeader.getCNonce(); + // String cnonce = authHeader.getCNonce(); logger.debug("nonce: " + nonce); logger.debug("nc: " + ncStr); logger.debug("cnonce: " + cnonce);