Encapsulates the various fields and eventual signing value that makes up an AWS4 signature. This can be used to retrieve the required authorization string or authorization query parameters for the final request as well as hold ongoing signature computations for subsequent calls related to the initial signing.
        internal ChunkedUploadWrapperStream(Stream stream, int wrappedStreamBufferSize, AWS4SigningResult headerSigningResult)
            : base(stream)
        {
            HeaderSigningResult = headerSigningResult;
            PreviousChunkSignature = headerSigningResult.Signature;

            _wrappedStreamBufferSize = wrappedStreamBufferSize;
            _inputBuffer = new byte[DefaultChunkSize];
            _outputBuffer = new byte[CalculateChunkHeaderLength(DefaultChunkSize)]; // header+data

#if BCL
            // if the wrapped stream implements encryption, switch to a read-and-copy
            // strategy for filling the chunk buffer
            var encryptionStream = SearchWrappedStream(s =>
                {
                    var encryptUploadPartStream = s as EncryptUploadPartStream;
                    if (encryptUploadPartStream != null)
                        return true;

                    var encryptStream = s as EncryptStream;
                    return encryptStream != null;
                });

            if (encryptionStream != null)
                _readStrategy = ReadStrategy.ReadAndCopy;
#endif
        }
Beispiel #2
0
        public override void Sign(IRequest request, IClientConfig clientConfig, RequestMetrics metrics, string awsAccessKeyId, string awsSecretAccessKey)
        {
            AWS4SigningResult aWS4SigningResult = SignRequest(request, clientConfig, metrics, awsAccessKeyId, awsSecretAccessKey);

            request.Headers["Authorization"] = aWS4SigningResult.ForAuthorizationHeader;
        }