code: private static String appSignatureBase(Credentials cred, String bucketName, String cosPath, long expired,
  			boolean uploadFlag) throws AbstractCosException {
  		int appId = cred.getAppId();
  		String secretId = cred.getSecretId();
  		String secretKey = cred.getSecretKey();
  		long now = System.currentTimeMillis() / 1000;
  		int rdm = Math.abs(new Random().nextInt());
  		String fileId = null;
  		if (uploadFlag) {
  			fileId = String.format("/%s/%s%s", appId, bucketName, cosPath);
  		} else {
  			fileId = cosPath;
  		}
  		fileId = CommonPathUtils.encodeRemotePath(fileId);
  		String plainText = String.format("a=%s&k=%s&e=%d&t=%d&r=%d&f=%s&b=%s", appId, secretId, expired, now, rdm,
  				fileId, bucketName);
  
  		byte[] hmacDigest;
  		try {
  			hmacDigest = CommonCodecUtils.HmacSha1(plainText, secretKey);
  		} catch (Exception e) {
  			throw new UnknownException(e.getMessage());
  		}
  		byte[] signContent = new byte[hmacDigest.length + plainText.getBytes().length];
  		System.arraycopy(hmacDigest, 0, signContent, 0, hmacDigest.length);
  		System.arraycopy(plainText.getBytes(), 0, signContent, hmacDigest.length, plainText.getBytes().length);
  
  		return CommonCodecUtils.Base64Encode(signContent);
  	}
docs: 返回用户访问资源的签名
  
  @param cred
  包含用户秘钥信息
  @param bucketName
  bucket名
  @param cosPath
  要签名的cos路径
  @param expired
  超时时间
  @param uploadFlag
  除了生成下载签名，其他情况updateFlag皆为true
  @return 返回base64编码的字符串
  @throws AbstractCosException