Example on https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-streaming-trailers.html
(t *testing.T)
| 90 | |
| 91 | // Example on https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-streaming-trailers.html |
| 92 | func TestTrailerChunkSignature(t *testing.T) { |
| 93 | chunkData := []byte("x-amz-checksum-crc32c:wdBDMA==\n") |
| 94 | reqTime, _ := time.Parse(iso8601DateFormat, "20130524T000000Z") |
| 95 | previousSignature := "e05ab64fe1dfdbf0b5870abbaabdb063c371d4e96f2767e6934d90529c5ae850" |
| 96 | location := "us-east-1" |
| 97 | secretAccessKeyID := "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" |
| 98 | expectedSignature := "41e14ac611e27a8bb3d66c3bad6856f209297767d5dd4fc87d8fa9e422e03faf" |
| 99 | chunkCheckSum := sum256hex(chunkData) |
| 100 | actualSignature := buildTrailerChunkSignature(chunkCheckSum, reqTime, location, previousSignature, secretAccessKeyID, ServiceTypeS3) |
| 101 | if actualSignature != expectedSignature { |
| 102 | t.Errorf("Expected %s but received %s", expectedSignature, actualSignature) |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | func TestSetStreamingAuthorization(t *testing.T) { |
| 107 | location := "us-east-1" |
nothing calls this directly
no test coverage detected