|
@ -84,21 +84,21 @@ public class KCPlayerSignature{ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static void main(String[] args) { |
|
|
static void main(String[] args) { |
|
|
KCPlayerSignature sign = new KCPlayerSignature(); |
|
|
// KCPlayerSignature sign = new KCPlayerSignature();
|
|
|
// 设置 App 的云 API 密钥
|
|
|
// // 设置 App 的云 API 密钥
|
|
|
sign.setSecretId("个人 API 密钥中的 Secret Id"); |
|
|
// sign.setSecretId("个人 API 密钥中的 Secret Id");
|
|
|
sign.setSecretKey("个人 API 密钥中的 Secret Key"); |
|
|
// sign.setSecretKey("个人 API 密钥中的 Secret Key");
|
|
|
sign.setCurrentTime(System.currentTimeMillis() / 1000); |
|
|
// sign.setCurrentTime(System.currentTimeMillis() / 1000);
|
|
|
sign.setRandom(new Random().nextInt(java.lang.Integer.MAX_VALUE)); |
|
|
// sign.setRandom(new Random().nextInt(java.lang.Integer.MAX_VALUE));
|
|
|
// 签名有效期:2天
|
|
|
// // 签名有效期:2天
|
|
|
sign.setSignValidDuration(3600 * 24 * 2); |
|
|
// sign.setSignValidDuration(3600 * 24 * 2);
|
|
|
|
|
|
//
|
|
|
try { |
|
|
// try {
|
|
|
String signature = sign.getUploadSignature(id); |
|
|
// String signature = sign.getUploadSignature(id);
|
|
|
System.out.println("signature : " + signature); |
|
|
// System.out.println("signature : " + signature);
|
|
|
} catch (Exception e) { |
|
|
// } catch (Exception e) {
|
|
|
System.out.print("获取签名失败"); |
|
|
// System.out.print("获取签名失败");
|
|
|
e.printStackTrace(); |
|
|
// e.printStackTrace();
|
|
|
} |
|
|
// }
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |