xushengqiang 4 jaren geleden
bovenliggende
commit
89fb65aa31
1 gewijzigde bestanden met toevoegingen van 5 en 5 verwijderingen
  1. 5 5
      src/main/java/cn/efunbox/audio/utils/Encrypt.java

+ 5 - 5
src/main/java/cn/efunbox/audio/utils/Encrypt.java

@@ -83,7 +83,7 @@ public class Encrypt {
         } catch (UnsupportedEncodingException e) {
             e.printStackTrace();
         }
-        log.info("HMACSHA256 data : {} , sign : {}",str,encdeStr);
+        log.info("SHA256 data : {} , sign : {}",str,encdeStr);
         return encdeStr;
     }
     //---------
@@ -173,7 +173,7 @@ public class Encrypt {
 
         byte[] array = sha256_HMAC.doFinal(data.getBytes("UTF-8"));
 
-        String encodeSign = base64.encodeToString(array);
+        String encodeSign = base64.encodeBase64String(array);
         log.info("HMACSHA256 data : {} , sign : {}",data,encodeSign);
         return encodeSign;
 
@@ -187,10 +187,10 @@ public class Encrypt {
         param.put("idChannel","100103");
         param.put("idDevice","10.31.49.16");
 
-        String sign1 = Encrypt.createSHA256Sign(param, "IhOTiTyMLDNNLFuP");
-        log.info(sign1);
+//        String sign1 = Encrypt.createSHA256Sign(param, "IhOTiTyMLDNNLFuP");
+//        log.info(sign1);
 
-        param.put("x-ts",System.currentTimeMillis()  + "");
+        param.put("x-ts","159591203325");
         log.info(JSONObject.toJSONString(param));
         String sign = Encrypt.createHMACSHA256(param,"IhOTiTyMLDNNLFuP");
         log.info(sign);