1:生成随机数nonce
String Nonce = UUIDUtil.getUUIDString().replaceAll("-", "");
2:生成GMT时间
Calendar cd = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss 'GMT'", Locale.US);
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String Date = sdf.format(cd.getTime());
3:hmac-sha1 加密签名
byte[] bytekey = accessKeySecret.getBytes("UTF-8");
String HMAC_SHA1_ALGORITHM = "HmacSHA1";
SecretKeySpec signinKey = new SecretKeySpec(bytekey, HMAC_SHA1_ALGORITHM);
Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
mac.init(signinKey);
byte[] rawHmac = mac.doFinal(postData.getBytes("UTF-8"));
byte[] result = Base64Utils.base64Encoding(rawHmac);
String signature = new String(result);