C# Класс Amazon.Runtime.Internal.Auth.AWS4Signer

Наследование: AbstractAWSSigner
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
TerminatorBytes byte[]

Открытые методы

Метод Описание
ComposeSigningKey ( string awsSecretAccessKey, string region, string date, string service ) : byte[]

Compute and return the multi-stage signing key for the request.

ComputeHash ( byte data ) : byte[]

Computes the non-keyed hash of the supplied data

ComputeHash ( string data ) : byte[]

Computes the non-keyed hash of the supplied data

ComputeKeyedHash ( SigningAlgorithm algorithm, byte key, byte data ) : byte[]

Compute and return the hash of a data blob using the specified key

ComputeKeyedHash ( SigningAlgorithm algorithm, byte key, string data ) : byte[]

Compute and return the hash of a data blob using the specified key

ComputeSignature ( ImmutableCredentials credentials, string region, System.DateTime signedAt, string service, string signedHeaders, string canonicalRequest ) : AWS4SigningResult

Computes and returns an AWS4 signature for the specified canonicalized request

ComputeSignature ( string awsAccessKey, string awsSecretAccessKey, string region, System.DateTime signedAt, string service, string signedHeaders, string canonicalRequest ) : AWS4SigningResult

Computes and returns an AWS4 signature for the specified canonicalized request

ComputeSignature ( string awsAccessKey, string awsSecretAccessKey, string region, System.DateTime signedAt, string service, string signedHeaders, string canonicalRequest, RequestMetrics metrics ) : AWS4SigningResult

Computes and returns an AWS4 signature for the specified canonicalized request

DetermineSigningRegion ( IClientConfig clientConfig, string serviceName, RegionEndpoint alternateEndpoint, IRequest request ) : string
FormatDateTime ( System.DateTime dt, string formatString ) : string

Formats the supplied date and time for use in AWS4 signing, where various formats are used.

InitializeHeaders ( string>.IDictionary headers, Uri requestEndpoint ) : System.DateTime

Sets the AWS4 mandated 'host' and 'x-amz-date' headers, returning the date/time that will be used throughout the signing process in various elements and formats.

InitializeHeaders ( string>.IDictionary headers, Uri requestEndpoint, System.DateTime requestDateTime ) : System.DateTime

Sets the AWS4 mandated 'host' and 'x-amz-date' headers, accepting and returning the date/time that will be used throughout the signing process in various elements and formats.

SetRequestBodyHash ( IRequest request ) : string

If the caller has already set the x-amz-content-sha256 header with a pre-computed content hash, or it is present as ContentStreamHash on the request instance, return the value to be used in request canonicalization. If not set as a header or in the request, attempt to compute a hash based on inspection of the style of the request content.

Sign ( IRequest request, IClientConfig clientConfig, RequestMetrics metrics, string awsAccessKeyId, string awsSecretAccessKey ) : void

Calculates and signs the specified request using the AWS4 signing protocol by using the AWS account credentials given in the method parameters. The resulting signature is added to the request headers as 'Authorization'. Parameters supplied in the request, either in the resource path as a query string or in the Parameters collection must not have been uri encoded. If they have, use the SignRequest method to obtain a signature.

SignBlob ( byte key, byte data ) : byte[]

Returns the HMAC256 for an arbitrary blob using the specified key

SignBlob ( byte key, string data ) : byte[]

Returns the HMAC256 for an arbitrary blob using the specified key

SignRequest ( IRequest request, IClientConfig clientConfig, RequestMetrics metrics, string awsAccessKeyId, string awsSecretAccessKey ) : AWS4SigningResult

Calculates and signs the specified request using the AWS4 signing protocol by using the AWS account credentials given in the method parameters.

Parameters passed as part of the resource path should be uri-encoded prior to entry to the signer. Parameters passed in the request.Parameters collection should be not be encoded; encoding will be done for these parameters as part of the construction of the canonical request.

Защищенные методы

Метод Описание
CanonicalizeHeaderNames ( string>.IEnumerable sortedHeaders ) : string

Returns the set of headers included in the signature as a flattened, ;-delimited string

CanonicalizeHeaders ( string>.IEnumerable sortedHeaders ) : string

Computes the canonical headers with values for the request. Only headers included in the signature are included in the canonicalization process.

CanonicalizeQueryParameters ( string>.IDictionary parameters ) : string
CanonicalizeQueryParameters ( string>.IDictionary parameters, bool uriEncodeParameters ) : string

Computes and returns the canonicalized query string, if query parameters have been supplied. Parameters with no value will be canonicalized as 'param='. The expectation is that parameters have not already been url encoded prior to canonicalization.

CanonicalizeQueryParameters ( string queryString ) : string
CanonicalizeQueryParameters ( string queryString, bool uriEncodeParameters ) : string

Computes and returns the canonicalized query string, if query parameters have been supplied. Parameters with no value will be canonicalized as 'param='. The expectation is that parameters have not already been url encoded prior to canonicalization.

CanonicalizeRequest ( Uri endpoint, string resourcePath, string httpMethod, string>.IDictionary sortedHeaders, string canonicalQueryString, string precomputedBodyHash ) : string

Computes and returns the canonical request

GetParametersToCanonicalize ( IRequest request ) : string>.IDictionary

Collects the subresource and query string parameters into one collection ready for canonicalization

SortAndPruneHeaders ( string>.IEnumerable requestHeaders ) : string>.IDictionary

Reorders the headers for the request for canonicalization.

For AWS4 signing, all headers are considered viable for inclusion

Приватные методы

Метод Описание
CleanHeaders ( string>.IDictionary headers ) : void
CompressSpaces ( string data ) : string
DetermineService ( IClientConfig clientConfig ) : string
GetRequestPayloadBytes ( IRequest request ) : byte[]

Returns the request parameters in the form of a query string.

Описание методов

CanonicalizeHeaderNames() защищенный статический Метод

Returns the set of headers included in the signature as a flattened, ;-delimited string
protected static CanonicalizeHeaderNames ( string>.IEnumerable sortedHeaders ) : string
sortedHeaders string>.IEnumerable The headers included in the signature
Результат string

CanonicalizeHeaders() защищенный статический Метод

Computes the canonical headers with values for the request. Only headers included in the signature are included in the canonicalization process.
protected static CanonicalizeHeaders ( string>.IEnumerable sortedHeaders ) : string
sortedHeaders string>.IEnumerable All request headers, sorted into canonical order
Результат string

CanonicalizeQueryParameters() защищенный статический Метод

protected static CanonicalizeQueryParameters ( string>.IDictionary parameters ) : string
parameters string>.IDictionary
Результат string

CanonicalizeQueryParameters() защищенный статический Метод

Computes and returns the canonicalized query string, if query parameters have been supplied. Parameters with no value will be canonicalized as 'param='. The expectation is that parameters have not already been url encoded prior to canonicalization.
protected static CanonicalizeQueryParameters ( string>.IDictionary parameters, bool uriEncodeParameters ) : string
parameters string>.IDictionary The set of parameters to be encoded in the query string
uriEncodeParameters bool /// Parameters must be uri encoded into the canonical request and by default the signer expects /// that the supplied collection contains non-encoded data. Set this to false if the encoding was /// done prior to signer entry. ///
Результат string

CanonicalizeQueryParameters() защищенный статический Метод

protected static CanonicalizeQueryParameters ( string queryString ) : string
queryString string
Результат string

CanonicalizeQueryParameters() защищенный статический Метод

Computes and returns the canonicalized query string, if query parameters have been supplied. Parameters with no value will be canonicalized as 'param='. The expectation is that parameters have not already been url encoded prior to canonicalization.
protected static CanonicalizeQueryParameters ( string queryString, bool uriEncodeParameters ) : string
queryString string The set of parameters being passed on the uri
uriEncodeParameters bool /// Parameters must be uri encoded into the canonical request and by default the signer expects /// that the supplied collection contains non-encoded data. Set this to false if the encoding was /// done prior to signer entry. ///
Результат string

CanonicalizeRequest() защищенный статический Метод

Computes and returns the canonical request
protected static CanonicalizeRequest ( Uri endpoint, string resourcePath, string httpMethod, string>.IDictionary sortedHeaders, string canonicalQueryString, string precomputedBodyHash ) : string
endpoint System.Uri The endpoint URL
resourcePath string the path of the resource being operated on
httpMethod string The http method used for the request
sortedHeaders string>.IDictionary The full request headers, sorted into canonical order
canonicalQueryString string The query parameters for the request
precomputedBodyHash string /// The hash of the binary request body if present. If not supplied, the routine /// will look for the hash as a header on the request. ///
Результат string

ComposeSigningKey() публичный статический Метод

Compute and return the multi-stage signing key for the request.
public static ComposeSigningKey ( string awsSecretAccessKey, string region, string date, string service ) : byte[]
awsSecretAccessKey string The clear-text AWS secret key, if not held in secureKey
region string The region in which the service request will be processed
date string Date of the request, in yyyyMMdd format
service string The name of the service being called by the request
Результат byte[]

ComputeHash() публичный статический Метод

Computes the non-keyed hash of the supplied data
public static ComputeHash ( byte data ) : byte[]
data byte
Результат byte[]

ComputeHash() публичный статический Метод

Computes the non-keyed hash of the supplied data
public static ComputeHash ( string data ) : byte[]
data string
Результат byte[]

ComputeKeyedHash() публичный статический Метод

Compute and return the hash of a data blob using the specified key
public static ComputeKeyedHash ( SigningAlgorithm algorithm, byte key, byte data ) : byte[]
algorithm SigningAlgorithm Algorithm to use for hashing
key byte Hash key
data byte Data blob
Результат byte[]

ComputeKeyedHash() публичный статический Метод

Compute and return the hash of a data blob using the specified key
public static ComputeKeyedHash ( SigningAlgorithm algorithm, byte key, string data ) : byte[]
algorithm SigningAlgorithm Algorithm to use for hashing
key byte Hash key
data string Data blob
Результат byte[]

ComputeSignature() публичный статический Метод

Computes and returns an AWS4 signature for the specified canonicalized request
public static ComputeSignature ( ImmutableCredentials credentials, string region, System.DateTime signedAt, string service, string signedHeaders, string canonicalRequest ) : AWS4SigningResult
credentials Amazon.Runtime.ImmutableCredentials
region string
signedAt System.DateTime
service string
signedHeaders string
canonicalRequest string
Результат AWS4SigningResult

ComputeSignature() публичный статический Метод

Computes and returns an AWS4 signature for the specified canonicalized request
public static ComputeSignature ( string awsAccessKey, string awsSecretAccessKey, string region, System.DateTime signedAt, string service, string signedHeaders, string canonicalRequest ) : AWS4SigningResult
awsAccessKey string
awsSecretAccessKey string
region string
signedAt System.DateTime
service string
signedHeaders string
canonicalRequest string
Результат AWS4SigningResult

ComputeSignature() публичный статический Метод

Computes and returns an AWS4 signature for the specified canonicalized request
public static ComputeSignature ( string awsAccessKey, string awsSecretAccessKey, string region, System.DateTime signedAt, string service, string signedHeaders, string canonicalRequest, RequestMetrics metrics ) : AWS4SigningResult
awsAccessKey string
awsSecretAccessKey string
region string
signedAt System.DateTime
service string
signedHeaders string
canonicalRequest string
metrics Amazon.Runtime.Internal.Util.RequestMetrics
Результат AWS4SigningResult

DetermineSigningRegion() публичный статический Метод

public static DetermineSigningRegion ( IClientConfig clientConfig, string serviceName, RegionEndpoint alternateEndpoint, IRequest request ) : string
clientConfig IClientConfig
serviceName string
alternateEndpoint RegionEndpoint
request IRequest
Результат string

FormatDateTime() публичный статический Метод

Formats the supplied date and time for use in AWS4 signing, where various formats are used.
public static FormatDateTime ( System.DateTime dt, string formatString ) : string
dt System.DateTime
formatString string The required format
Результат string

GetParametersToCanonicalize() защищенный статический Метод

Collects the subresource and query string parameters into one collection ready for canonicalization
protected static GetParametersToCanonicalize ( IRequest request ) : string>.IDictionary
request IRequest The in-flight request being signed
Результат string>.IDictionary

InitializeHeaders() публичный статический Метод

Sets the AWS4 mandated 'host' and 'x-amz-date' headers, returning the date/time that will be used throughout the signing process in various elements and formats.
public static InitializeHeaders ( string>.IDictionary headers, Uri requestEndpoint ) : System.DateTime
headers string>.IDictionary The current set of headers
requestEndpoint System.Uri
Результат System.DateTime

InitializeHeaders() публичный статический Метод

Sets the AWS4 mandated 'host' and 'x-amz-date' headers, accepting and returning the date/time that will be used throughout the signing process in various elements and formats.
public static InitializeHeaders ( string>.IDictionary headers, Uri requestEndpoint, System.DateTime requestDateTime ) : System.DateTime
headers string>.IDictionary The current set of headers
requestEndpoint System.Uri
requestDateTime System.DateTime
Результат System.DateTime

SetRequestBodyHash() публичный статический Метод

If the caller has already set the x-amz-content-sha256 header with a pre-computed content hash, or it is present as ContentStreamHash on the request instance, return the value to be used in request canonicalization. If not set as a header or in the request, attempt to compute a hash based on inspection of the style of the request content.
public static SetRequestBodyHash ( IRequest request ) : string
request IRequest
Результат string

Sign() публичный Метод

Calculates and signs the specified request using the AWS4 signing protocol by using the AWS account credentials given in the method parameters. The resulting signature is added to the request headers as 'Authorization'. Parameters supplied in the request, either in the resource path as a query string or in the Parameters collection must not have been uri encoded. If they have, use the SignRequest method to obtain a signature.
/// If any problems are encountered while signing the request. ///
public Sign ( IRequest request, IClientConfig clientConfig, RequestMetrics metrics, string awsAccessKeyId, string awsSecretAccessKey ) : void
request IRequest /// The request to compute the signature for. Additional headers mandated by the AWS4 protocol /// ('host' and 'x-amz-date') will be added to the request before signing. ///
clientConfig IClientConfig /// Client configuration data encompassing the service call (notably authentication /// region, endpoint and service name). ///
metrics Amazon.Runtime.Internal.Util.RequestMetrics /// Metrics for the request ///
awsAccessKeyId string /// The AWS public key for the account making the service call. ///
awsSecretAccessKey string /// The AWS secret key for the account making the call, in clear text. ///
Результат void

SignBlob() публичный статический Метод

Returns the HMAC256 for an arbitrary blob using the specified key
public static SignBlob ( byte key, byte data ) : byte[]
key byte
data byte
Результат byte[]

SignBlob() публичный статический Метод

Returns the HMAC256 for an arbitrary blob using the specified key
public static SignBlob ( byte key, string data ) : byte[]
key byte
data string
Результат byte[]

SignRequest() публичный Метод

Calculates and signs the specified request using the AWS4 signing protocol by using the AWS account credentials given in the method parameters.
Parameters passed as part of the resource path should be uri-encoded prior to entry to the signer. Parameters passed in the request.Parameters collection should be not be encoded; encoding will be done for these parameters as part of the construction of the canonical request.
/// If any problems are encountered while signing the request. ///
public SignRequest ( IRequest request, IClientConfig clientConfig, RequestMetrics metrics, string awsAccessKeyId, string awsSecretAccessKey ) : AWS4SigningResult
request IRequest /// The request to compute the signature for. Additional headers mandated by the AWS4 protocol /// ('host' and 'x-amz-date') will be added to the request before signing. ///
clientConfig IClientConfig /// Client configuration data encompassing the service call (notably authentication /// region, endpoint and service name). ///
metrics Amazon.Runtime.Internal.Util.RequestMetrics /// Metrics for the request. ///
awsAccessKeyId string /// The AWS public key for the account making the service call. ///
awsSecretAccessKey string /// The AWS secret key for the account making the call, in clear text. ///
Результат AWS4SigningResult

SortAndPruneHeaders() защищенный статический Метод

Reorders the headers for the request for canonicalization.
For AWS4 signing, all headers are considered viable for inclusion
protected static SortAndPruneHeaders ( string>.IEnumerable requestHeaders ) : string>.IDictionary
requestHeaders string>.IEnumerable The set of proposed headers for the request
Результат string>.IDictionary

Описание свойств

TerminatorBytes публичное статическое свойство

public static byte[] TerminatorBytes
Результат byte[]