public final class SignerUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
addDateHeader(SdkHttpRequest.Builder requestBuilder,
String dateTime)
Add a date header using a datetime string
|
static void |
addHostHeader(SdkHttpRequest.Builder requestBuilder)
Add the host header based on parameters of a request
|
static byte[] |
computeSignature(String stringToSign,
byte[] signingKey)
Compute the signature of a string using a signing key.
|
static byte[] |
deriveSigningKey(AwsCredentialsIdentity credentials,
CredentialScope credentialScope)
Get the signing key based on the given credentials and a credential-scope
|
static String |
formatDate(Instant instant)
Returns a string representation of the given datetime in yyyyMMdd format.
|
static String |
formatDateTime(Instant instant)
Returns a string representation of the given datetime in yyyyMMdd'T'HHmmss'Z' format.
|
static InputStream |
getBinaryRequestPayloadStream(ContentStreamProvider streamProvider) |
static String |
getContentHash(SdkHttpRequest.Builder requestBuilder) |
static byte[] |
hash(byte[] data) |
static byte[] |
hash(InputStream input) |
static byte[] |
hash(String text) |
static String |
hashCanonicalRequest(String canonicalRequestString)
Create a hash of the canonical request string
|
static long |
moveContentLength(SdkHttpRequest.Builder request,
InputStream payload)
Move `Content-Length` to `x-amz-decoded-content-length` if not already present.
|
static byte[] |
sign(byte[] data,
byte[] key,
SigningAlgorithm algorithm)
Sign given data using a key and a specific algorithm
|
static byte[] |
sign(String stringData,
byte[] key)
Sign given data using a key.
|
public static String formatDate(Instant instant)
For example, given an Instant with millis-value of 1416863450581, this method returns "20141124"
public static String formatDateTime(Instant instant)
For example, given an Instant with millis-value of 1416863450581, this method returns "20141124T211050Z"
public static String hashCanonicalRequest(String canonicalRequestString)
Step 2 of the AWS Signature version 4 calculation. Refer to https://docs.aws.amazon.com/IAM/latest/UserGuide/create-signed-request.html#create-canonical-request-hash.
public static byte[] deriveSigningKey(AwsCredentialsIdentity credentials, CredentialScope credentialScope)
public static byte[] sign(String stringData, byte[] key)
public static byte[] sign(byte[] data,
byte[] key,
SigningAlgorithm algorithm)
public static byte[] computeSignature(String stringToSign, byte[] signingKey)
Step 4 of the AWS Signature version 4 calculation. Refer to https://docs.aws.amazon.com/IAM/latest/UserGuide/create-signed-request.html#calculate-signature.
public static void addHostHeader(SdkHttpRequest.Builder requestBuilder)
public static void addDateHeader(SdkHttpRequest.Builder requestBuilder, String dateTime)
public static long moveContentLength(SdkHttpRequest.Builder request, InputStream payload)
public static InputStream getBinaryRequestPayloadStream(ContentStreamProvider streamProvider)
public static byte[] hash(InputStream input)
public static byte[] hash(byte[] data)
public static byte[] hash(String text)
public static String getContentHash(SdkHttpRequest.Builder requestBuilder)
Copyright © 2023. All rights reserved.