net.polyv.live.v1.util
类 LiveSignUtil

java.lang.Object
  继承者 net.polyv.live.v1.util.LiveSignUtil

public class LiveSignUtil
extends Object

polyv 直播签名工具类


方法摘要
static String byteArrayToHex(byte[] byteArray)
          将字节数组换成成16进制的字符串
static String concatParams(Map<String,String> params)
          把数组所有元素排序,并按照“参数参数值”的模式成字符串,用于计算MD5哈希值
static String generateUUID()
           
static String getSign(Map<String,String> params, String appId, String appSecret)
          获取直播加密字符串,并且假如到参数params中
static String mapJoinEncode(Map<String,String> map, boolean keyLower, boolean valueUrlEncode)
          url 参数串连
static String mapJoinNotEncode(Map<String,String> map)
          url 参数串连但是不进行参数Encode
static String md5Hex(String text)
          对字符串做MD5加密,返回加密后的字符串。
static String setLiveSign(Map<String,String> params, String appId, String appSecret)
          获取直播加密字符串,并且假如到参数params中
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

方法详细信息

generateUUID

public static String generateUUID()

setLiveSign

public static String setLiveSign(Map<String,String> params,
                                 String appId,
                                 String appSecret)
                          throws NoSuchAlgorithmException,
                                 UnsupportedEncodingException
获取直播加密字符串,并且假如到参数params中

参数:
params - 加密参数
appId - 保利威用户ID
appSecret - 保利威用户签名密钥
返回:
MD5签名字符串
抛出:
NoSuchAlgorithmException - 签名异常
UnsupportedEncodingException

getSign

public static String getSign(Map<String,String> params,
                             String appId,
                             String appSecret)
                      throws NoSuchAlgorithmException,
                             UnsupportedEncodingException
获取直播加密字符串,并且假如到参数params中

参数:
params - 加密参数
appId - 保利威用户ID
appSecret - 保利威用户签名密钥
返回:
MD5签名字符串
抛出:
NoSuchAlgorithmException - 签名异常
UnsupportedEncodingException

concatParams

public static String concatParams(Map<String,String> params)
把数组所有元素排序,并按照“参数参数值”的模式成字符串,用于计算MD5哈希值

参数:
params - 需要排序并参与字符拼接的参数组
返回:
拼接后字符串

md5Hex

public static String md5Hex(String text)
                     throws NoSuchAlgorithmException,
                            UnsupportedEncodingException
对字符串做MD5加密,返回加密后的字符串。

参数:
text - 待加密的字符串。
返回:
加密后的字符串。
抛出:
NoSuchAlgorithmException - 签名异常
UnsupportedEncodingException

byteArrayToHex

public static String byteArrayToHex(byte[] byteArray)
将字节数组换成成16进制的字符串

参数:
byteArray - 字节
返回:
字符串

mapJoinNotEncode

public static String mapJoinNotEncode(Map<String,String> map)
url 参数串连但是不进行参数Encode

参数:
map - map
返回:
string

mapJoinEncode

public static String mapJoinEncode(Map<String,String> map,
                                   boolean keyLower,
                                   boolean valueUrlEncode)
                            throws UnsupportedEncodingException
url 参数串连

参数:
map - map
keyLower - keyLower
valueUrlEncode - valueUrlEncode
返回:
string
抛出:
UnsupportedEncodingException - 编码异常


Copyright © 2020. All Rights Reserved.