getSignature static method
获取签名
Implementation
static String getSignature(String policyText) {
//进行utf8编码
List<int> policyUtf8 = utf8.encode(policyText);
//进行base64编码
String policyBase64 = base64.encode(policyUtf8);
//再次进行utf8编码
List<int> policy = utf8.encode(policyBase64);
//进行utf8 编码
List<int> key = utf8.encode(accessKeySecret);
//通过hmac,使用sha1进行加密
List<int> signaturePre = Hmac(sha1, key).convert(policy).bytes;
//最后一步,将上述所得进行base64 编码
String signature = base64.encode(signaturePre);
return signature;
}