直播控制台频道托管没有API鉴权key, 请问怎么生成sign呢?否则无法调用各种API
发布网友
发布时间:2022-04-29 12:37
我来回答
共1个回答
热心网友
时间:2023-10-06 06:12
SortedMap<Object, Object> requestParams = new TreeMap<Object, Object>();
requestParams.put("version", "1");
requestParams.put("userName", "123456");
requestParams.put("password", "123456");
StringBuffer requestParamsStringBuffer = new StringBuffer();
System.out.println("排序之后的Key Value:");
for (Map.Entry<Object, Object> entry : requestParams.entrySet()) {
System.out.println(entry.getKey() + " " + entry.getValue());
requestParamsStringBuffer.append(entry.getKey() + "" + entry.getValue());
}
System.out.println(requestParamsStringBuffer.toString());
String md5="";
try {
md5 = MD5.getMd5(requestParamsStringBuffer.toString());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
System.out.println("request params md5加密后:" + md5);
//request params md5加密后:d42fdf5e525386c648b1303fa2aa5aab