云点播为什么鉴权一直都是失败的?

{

"Response": {

"Error": {

"Code": "AuthFailure.SignatureFailure",

"Message": "The provided credentials could not be validated. Please check your signature is correct."

},

"RequestId": "ae67fddc-701c-4ee6-a2e5-db2697570421"

}

}

https://vod.tencentcloudapi.com/

String service = "vod";

String host = "vod.tencentcloudapi.com/";

String region = "ap-guangzhou";

String action = "DescribeMediaInfos";

String version = "2018-07-17";

String algorithm = "TC3-HMAC-SHA256";

//String timestamp = "1551113065";

String timestamp = String.valueOf(System.currentTimeMillis() / 1000);

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

// 注意时区,否则容易出错

sdf.setTimeZone(TimeZone.getTimeZone("UTC"));

String date = sdf.format(new Date(Long.valueOf(timestamp + "000")));

// ************* 步骤 1:拼接规范请求串 *************

String httpRequestMethod = "POST";

String canonicalUri = "/";

String canonicalQueryString = "";

String canonicalHeaders = "content-type:application/json; charset=utf-8\n" + "host:" + host + "\n";

String signedHeaders = "content-type;host";

String payload = "{\"Limit\": 1, \"Filters\": [{\"Values\": [\"\\u672a\\u547d\\u540d\"], \"Name\": \"instance-name\"}]}";

String hashedRequestPayload = sha256Hex(payload);

String canonicalRequest = httpRequestMethod + "\n" + canonicalUri + "\n" + canonicalQueryString + "\n"

+ canonicalHeaders + "\n" + signedHeaders + "\n" + hashedRequestPayload;

System.out.println("canonicalRequest:::::"+canonicalRequest);

// ************* 步骤 2:拼接待签名字符串 *************

String credentialScope = date + "/" + service + "/" + "tc3_request";

String hashedCanonicalRequest = sha256Hex(canonicalRequest);

String stringToSign = algorithm + "\n" + timestamp + "\n" + credentialScope + "\n" + hashedCanonicalRequest;

System.out.println("stringToSign:::::"+stringToSign);

// ************* 步骤 3:计算签名 *************

byte[] secretDate = hmac256(("TC3" + SECRET_KEY).getBytes(UTF8), date);

byte[] secretService = hmac256(secretDate, service);

byte[] secretSigning = hmac256(secretService, "tc3_request");

String signature = DatatypeConverter.printHexBinary(hmac256(secretSigning, stringToSign)).toLowerCase();

System.out.println("signature::::::"+signature);

// ************* 步骤 4:拼接 Authorization *************

String authorization = algorithm + " " + "Credential=" + SECRET_ID + "/" + credentialScope + ", "

+ "SignedHeaders=" + signedHeaders + ", " + "Signature=" + signature;

System.out.println("authorization:::::"+authorization);

TreeMap<String, String> headers = new TreeMap<String, String>();

headers.put("Authorization", authorization);

headers.put("Content-Type", CT_JSON);

headers.put("Host", host);

headers.put("X-TC-Action", action);

headers.put("X-TC-Timestamp", timestamp);

headers.put("X-TC-Version", version);

headers.put("X-TC-Region", region);

StringBuilder sb = new StringBuilder();

sb.append("curl -X POST https://").append(host)

.append(" -H \"Authorization: ").append(authorization).append("\"")

.append(" -H \"Content-Type: application/json; charset=utf-8\"")

.append(" -H \"Host: ").append(host).append("\"")

.append(" -H \"X-TC-Action: ").append(action).append("\"")

.append(" -H \"X-TC-Timestamp: ").append(timestamp).append("\"")

.append(" -H \"X-TC-Version: ").append(version).append("\"")

.append(" -H \"X-TC-Region: ").append(region).append("\"")

.append(" -d '").append(payload).append("'");

System.out.println(sb.toString());

String FileId = "52858908035781111000";

JSONObject paramS = new JSONObject();

paramS.put("Action","DescribeMediaInfos");

paramS.put("FileIds.0",FileId);

paramS.put("Filters.0","basicInfo");

String resultStr = Http.post("https://vod.tencentcloudapi.com/", headers, paramS.toString(), "UTF-8");

没看出问题