title: Signing Get Requests with AWS4Signer: The request signature we calculated does not match the signature you provided
body: <p><strong>Context</strong></p>
  
  <p>I am trying to generate a GET request to fetch a file stored in my AWS S3 Bucket. The Link generated is to expire after an hour.</p>
  
  <p><strong>Additional Details</strong></p>
  
  <ul>
  <li>API : Used Amazon V2 SDK for Java - Developer Preview 11</li>
  <li>This error is also usually caused by having '+' in the access key, but none of my keys have them</li>
  </ul>
  
  <p><strong>Relevant Code</strong> </p>
  
  <pre><code>@Override
    public CompletableFuture&lt;String&gt; getSignedUrl(String key) {
      Aws4PresignerParams params = Aws4PresignerParams.builder()
          .awsCredentials(this.credentials)
          .signingName("s3")
          .signingRegion(Region.AP_SOUTH_1)
          .expirationTime(Instant.ofEpochSecond(60*60))
          .build();
      SdkHttpFullRequest request = SdkHttpFullRequest.builder()
          .host("s3.ap-south-1.amazonaws.com")
          .encodedPath("&lt;bucket name&gt;/" + key)
          .method(SdkHttpMethod.GET)
          .protocol("https")
          .build();
      SdkHttpFullRequest result = Aws4Signer.create().presign(request,params);
      return CompletableFuture.completedFuture(result.getUri().toString());
    }
  </code></pre>
  
  <p><strong>Error Output</strong>:</p>
  
  <p>Access Key Replaced by &lt;access key&gt;</p>
  
  <pre><code>&lt;Error&gt;
  &lt;Code&gt;SignatureDoesNotMatch&lt;/Code&gt;
  &lt;Message&gt;
  The request signature we calculated does not match the signature you provided. Check your key and signing method.
  &lt;/Message&gt;
  &lt;AWSAccessKeyId&gt;&lt;Access Key&gt;&lt;/AWSAccessKeyId&gt;
  &lt;StringToSign&gt;
  AWS4-HMAC-SHA256 20180828T031727Z 20180828/ap-south-1/s3/aws4_request ec1203b0c718bc306b351e17e6014965860a9af6743a559f986af8fbbee0845d
  &lt;/StringToSign&gt;
  &lt;SignatureProvided&gt;
  6e6abcdd52db1746723446f41566f1102072b42a8230a08fe7f1d555e98c931a
  &lt;/SignatureProvided&gt;
  &lt;StringToSignBytes&gt;
  41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 0a 32 30 31 38 30 38 32 38 54 30 33 31 37 32 37 5a 0a 32 30 31 38 30 38 32 38 2f 61 70 2d 73 6f 75 74 68 2d 31 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 65 63 31 32 30 33 62 30 63 37 31 38 62 63 33 30 36 62 33 35 31 65 31 37 65 36 30 31 34 39 36 35 38 36 30 61 39 61 66 36 37 34 33 61 35 35 39 66 39 38 36 61 66 38 66 62 62 65 65 30 38 34 35 64
  &lt;/StringToSignBytes&gt;
  &lt;CanonicalRequest&gt;
  GET /&lt;bucket name&gt;/imageTestLogo.svg X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Credential=&lt;access key&gt;%2F20180828%2Fap-south-1%2Fs3%2Faws4_request&amp;X-Amz-Date=20180828T031727Z&amp;X-Amz-Expires=3600&amp;X-Amz-SignedHeaders=host host:s3.ap-south-1.amazonaws.com host UNSIGNED-PAYLOAD
  &lt;/CanonicalRequest&gt;
  &lt;CanonicalRequestBytes&gt;
  47 45 54 0a 2f 73 74 67 70 6f 63 6b 65 74 70 69 6c 6c 73 69 6d 61 67 65 73 2f 69 6d 61 67 65 54 65 73 74 4c 6f 67 6f 2e 73 76 67 0a 58 2d 41 6d 7a 2d 41 6c 67 6f 72 69 74 68 6d 3d 41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 26 58 2d 41 6d 7a 2d 43 72 65 64 65 6e 74 69 61 6c 3d 41 4b 49 41 4a 49 41 36 4f 58 4a 36 5a 50 58 34 45 5a 55 51 25 32 46 32 30 31 38 30 38 32 38 25 32 46 61 70 2d 73 6f 75 74 68 2d 31 25 32 46 73 33 25 32 46 61 77 73 34 5f 72 65 71 75 65 73 74 26 58 2d 41 6d 7a 2d 44 61 74 65 3d 32 30 31 38 30 38 32 38 54 30 33 31 37 32 37 5a 26 58 2d 41 6d 7a 2d 45 78 70 69 72 65 73 3d 33 36 30 30 26 58 2d 41 6d 7a 2d 53 69 67 6e 65 64 48 65 61 64 65 72 73 3d 68 6f 73 74 0a 68 6f 73 74 3a 73 33 2e 61 70 2d 73 6f 75 74 68 2d 31 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 0a 68 6f 73 74 0a 55 4e 53 49 47 4e 45 44 2d 50 41 59 4c 4f 41 44
  &lt;/CanonicalRequestBytes&gt;
  &lt;RequestId&gt;5FC3A1A9AB1A9231&lt;/RequestId&gt;
  &lt;HostId&gt;
  /w3XcTplWGMQ7VwMQ6C7rIFVs0/kCEX2SD5/0j1MJNBLmByapAns3F3Bz0H0lyzypyrP18tNBlM=
  &lt;/HostId&gt;
  &lt;/Error&gt;
  </code></pre>