// Path: src/main/java/com/xiaomi/infra/galaxy/fds/android/exception/GalaxyFDSClientException.java
// public class GalaxyFDSClientException extends Exception {
// 
//   public GalaxyFDSClientException() {}
// 
//   public GalaxyFDSClientException(String message) {
//     super(message);
//   }
// 
//   public GalaxyFDSClientException(Throwable cause) {
//     super(cause);
//   }
// 
//   public GalaxyFDSClientException(String message, Throwable cause) {
//     super(message, cause);
//   }
// }
// 
// Path: src/main/java/com/xiaomi/infra/galaxy/fds/android/model/HttpHeaders.java
// public final class HttpHeaders {
//   /** RFC 1945 (HTTP/1.0) Section 10.2, RFC 2616 (HTTP/1.1) Section 14.8 */
//   public static final String AUTHORIZATION = "Authorization";
// 
//   /** RFC 2616 (HTTP/1.1) Section 14.9 */
//   public static final String CACHE_CONTROL = "Cache-Control";
// 
//   /** RFC 1945 (HTTP/1.0) Section 10.3, RFC 2616 (HTTP/1.1) Section 14.11 */
//   public static final String CONTENT_ENCODING = "Content-Encoding";
// 
//   /** RFC 1945 (HTTP/1.0) Section 10.4, RFC 2616 (HTTP/1.1) Section 14.13 */
//   public static final String CONTENT_LENGTH = "Content-Length";
// 
//   /** RFC 2616 (HTTP/1.1) Section 14.15 */
//   public static final String CONTENT_MD5 = "Content-MD5";
// 
//   /** RFC 2616 (HTTP/1.1) Section 14.16 */
//   public static final String CONTENT_RANGE = "Content-Range";
// 
//   /** RFC 1945 (HTTP/1.0) Section 10.5, RFC 2616 (HTTP/1.1) Section 14.17 */
//   public static final String CONTENT_TYPE = "Content-Type";
// 
//   /** RFC 1945 (HTTP/1.0) Section 10.6, RFC 2616 (HTTP/1.1) Section 14.18 */
//   public static final String DATE = "Date";
// 
//   /** RFC 1945 (HTTP/1.0) Section 10.10, RFC 2616 (HTTP/1.1) Section 14.29 */
//   public static final String LAST_MODIFIED = "Last-Modified";
// 
//   /** RFC 2616 (HTTP/1.1) Section 14.35 */
//   public static final String RANGE = "Range";
// }


import java.net.URI;
import java.net.URISyntaxException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import com.google.common.collect.LinkedListMultimap;
import org.apache.http.Header;
import org.apache.http.client.methods.HttpRequestBase;
import com.xiaomi.infra.galaxy.fds.Common;
import com.xiaomi.infra.galaxy.fds.android.exception.GalaxyFDSClientException;
import com.xiaomi.infra.galaxy.fds.android.model.HttpHeaders;
import com.xiaomi.infra.galaxy.fds.auth.signature.SignAlgorithm;
import com.xiaomi.infra.galaxy.fds.auth.signature.Signer;
import com.xiaomi.infra.galaxy.fds.model.HttpMethod;
package com.xiaomi.infra.galaxy.fds.android.auth;




public class SignatureCredential implements GalaxyFDSCredential {
  private static final ThreadLocal<SimpleDateFormat> DATE_FORMAT =
      new ThreadLocal<SimpleDateFormat>() {
        @Override
        protected SimpleDateFormat initialValue() {
          SimpleDateFormat format = new SimpleDateFormat(
              "EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
          format.setTimeZone(TimeZone.getTimeZone("GMT"));
          return format;
        }
      };

  private final String accessKeyId;
  private final String secretAccessKeyId;

  public SignatureCredential(String accessKeyId, String secretAccessKeyId) {
    this.accessKeyId = accessKeyId;
    this.secretAccessKeyId = secretAccessKeyId;
  }

  @Override
// Path: src/main/java/com/xiaomi/infra/galaxy/fds/android/exception/GalaxyFDSClientException.java
// public class GalaxyFDSClientException extends Exception {
// 
//   public GalaxyFDSClientException() {}
// 
//   public GalaxyFDSClientException(String message) {
//     super(message);
//   }
// 
//   public GalaxyFDSClientException(Throwable cause) {
//     super(cause);
//   }
// 
//   public GalaxyFDSClientException(String message, Throwable cause) {
//     super(message, cause);
//   }
// }
// 
// Path: src/main/java/com/xiaomi/infra/galaxy/fds/android/model/HttpHeaders.java
// public final class HttpHeaders {
//   /** RFC 1945 (HTTP/1.0) Section 10.2, RFC 2616 (HTTP/1.1) Section 14.8 */
//   public static final String AUTHORIZATION = "Authorization";
// 
//   /** RFC 2616 (HTTP/1.1) Section 14.9 */
//   public static final String CACHE_CONTROL = "Cache-Control";
// 
//   /** RFC 1945 (HTTP/1.0) Section 10.3, RFC 2616 (HTTP/1.1) Section 14.11 */
//   public static final String CONTENT_ENCODING = "Content-Encoding";
// 
//   /** RFC 1945 (HTTP/1.0) Section 10.4, RFC 2616 (HTTP/1.1) Section 14.13 */
//   public static final String CONTENT_LENGTH = "Content-Length";
// 
//   /** RFC 2616 (HTTP/1.1) Section 14.15 */
//   public static final String CONTENT_MD5 = "Content-MD5";
// 
//   /** RFC 2616 (HTTP/1.1) Section 14.16 */
//   public static final String CONTENT_RANGE = "Content-Range";
// 
//   /** RFC 1945 (HTTP/1.0) Section 10.5, RFC 2616 (HTTP/1.1) Section 14.17 */
//   public static final String CONTENT_TYPE = "Content-Type";
// 
//   /** RFC 1945 (HTTP/1.0) Section 10.6, RFC 2616 (HTTP/1.1) Section 14.18 */
//   public static final String DATE = "Date";
// 
//   /** RFC 1945 (HTTP/1.0) Section 10.10, RFC 2616 (HTTP/1.1) Section 14.29 */
//   public static final String LAST_MODIFIED = "Last-Modified";
// 
//   /** RFC 2616 (HTTP/1.1) Section 14.35 */
//   public static final String RANGE = "Range";
// }


// Path: src/main/java/com/xiaomi/infra/galaxy/fds/android/auth/SignatureCredential.java
import java.net.URI;
import java.net.URISyntaxException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import com.google.common.collect.LinkedListMultimap;
import org.apache.http.Header;
import org.apache.http.client.methods.HttpRequestBase;
import com.xiaomi.infra.galaxy.fds.Common;
import com.xiaomi.infra.galaxy.fds.android.exception.GalaxyFDSClientException;
import com.xiaomi.infra.galaxy.fds.android.model.HttpHeaders;
import com.xiaomi.infra.galaxy.fds.auth.signature.SignAlgorithm;
import com.xiaomi.infra.galaxy.fds.auth.signature.Signer;
import com.xiaomi.infra.galaxy.fds.model.HttpMethod;

package com.xiaomi.infra.galaxy.fds.android.auth;




public class SignatureCredential implements GalaxyFDSCredential {
  private static final ThreadLocal<SimpleDateFormat> DATE_FORMAT =
      new ThreadLocal<SimpleDateFormat>() {
        @Override
        protected SimpleDateFormat initialValue() {
          SimpleDateFormat format = new SimpleDateFormat(
              "EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
          format.setTimeZone(TimeZone.getTimeZone("GMT"));
          return format;
        }
      };

  private final String accessKeyId;
  private final String secretAccessKeyId;

  public SignatureCredential(String accessKeyId, String secretAccessKeyId) {
    this.accessKeyId = accessKeyId;
    this.secretAccessKeyId = secretAccessKeyId;
  }

  @Override
  public void addHeader(HttpRequestBase request) throws GalaxyFDSClientException {