/// <summary> /// Signs the final chunk containing trailing headers /// </summary> /// <param name="trailingHeaders">Trailing header keys and values</param> /// <param name="previousSignature">Signature of the previously signed chunk</param> /// <param name="headerSigningResult">Signing result for the "seed" signature consisting of headers</param> /// <returns>Signature of the trailing header chunk</returns> public string SignTrailingHeaderChunk(IDictionary <string, string> trailingHeaders, string previousSignature, AWS4aSigningResult headerSigningResult) { var signingConfig = PrepareCRTSigningConfig(AwsSignatureType.HTTP_REQUEST_TRAILING_HEADERS, headerSigningResult); signingConfig.SignedBodyHeader = AwsSignedBodyHeaderType.NONE; var headerArray = trailingHeaders.Select(kvp => new HttpHeader(kvp.Key, kvp.Value)).ToArray(); // The previous signature may be padded with '*' up to 144 characters, which is used // when actually sending a chunk but not when calculating the next chunk's signature. previousSignature = previousSignature.TrimEnd('*'); var signingResult = AwsSigner.SignTrailingHeaders(headerArray, Encoding.UTF8.GetBytes(previousSignature), signingConfig); return(Encoding.UTF8.GetString(signingResult.Get().Signature)); }