public abstract class AWS4SignerBase extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ALGORITHM |
protected SimpleDateFormat |
dateStampFormat |
static String |
DateStringFormat |
protected SimpleDateFormat |
dateTimeFormat |
static String |
EMPTY_BODY_SHA256
SHA256 hash of an empty request body
|
protected URL |
endpointUrl |
protected String |
httpMethod |
static String |
ISO8601BasicFormat
format strings for the date/time and date stamps required during signing
|
protected String |
regionName |
static String |
SCHEME |
protected String |
serviceName |
static String |
TERMINATOR |
static String |
UNSIGNED_PAYLOAD |
Constructor and Description |
---|
AWS4SignerBase(URL endpointUrl,
String httpMethod,
String serviceName,
String regionName)
Create a new AWS V4 signer.
|
Modifier and Type | Method and Description |
---|---|
protected static String |
getCanonicalizedHeaderString(Map<String,String> headers)
Computes the canonical headers with values for the request.
|
static String |
getCanonicalizedQueryString(Map<String,String> parameters)
Examines the specified query string parameters and returns a canonicalized form.
|
protected static String |
getCanonicalizedResourcePath(URL endpoint)
Returns the canonicalized resource path for the service endpoint.
|
protected static String |
getCanonicalizeHeaderNames(Map<String,String> headers)
Returns the canonical collection of header names that will be included in the signature.
|
protected static String |
getCanonicalRequest(URL endpoint,
String httpMethod,
String queryParameters,
String canonicalizedHeaderNames,
String canonicalizedHeaders,
String bodyHash)
Returns the canonical request string to go into the signer process; this consists of several canonical sub-parts.
|
protected static String |
getStringToSign(String scheme,
String algorithm,
String dateTime,
String scope,
String canonicalRequest) |
static byte[] |
hash(byte[] data)
Hashes the byte array using the SHA-256 algorithm.
|
static byte[] |
hash(String text)
Hashes the string contents (assumed to be UTF-8) using the SHA-256 algorithm.
|
protected static byte[] |
sign(String stringData,
byte[] key,
String algorithm) |
static String |
toHex(byte[] data) |
protected static String |
urlEncode(String url,
boolean keepPathSlash) |
public static final String EMPTY_BODY_SHA256
public static final String UNSIGNED_PAYLOAD
public static final String SCHEME
public static final String ALGORITHM
public static final String TERMINATOR
public static final String ISO8601BasicFormat
public static final String DateStringFormat
protected URL endpointUrl
protected String httpMethod
protected String serviceName
protected String regionName
protected final SimpleDateFormat dateTimeFormat
protected final SimpleDateFormat dateStampFormat
public AWS4SignerBase(URL endpointUrl, String httpMethod, String serviceName, String regionName)
endpointUrl
- The service endpoint, including the path to any resource.httpMethod
- The HTTP verb for the request, e.g. GET.serviceName
- The signing name of the service, e.g. 's3'.regionName
- The system name of the AWS region associated with the endpoint, e.g. us-east-1.protected static String getCanonicalizeHeaderNames(Map<String,String> headers)
protected static String getCanonicalizedHeaderString(Map<String,String> headers)
protected static String getCanonicalRequest(URL endpoint, String httpMethod, String queryParameters, String canonicalizedHeaderNames, String canonicalizedHeaders, String bodyHash)
protected static String getCanonicalizedResourcePath(URL endpoint)
public static String getCanonicalizedQueryString(Map<String,String> parameters)
The canonicalized query string is formed by first sorting all the query string parameters, then URI encoding both the key and value and then joining them, in order, separating key value pairs with an '&'.
parameters
- The query string parameters to be canonicalized.protected static String getStringToSign(String scheme, String algorithm, String dateTime, String scope, String canonicalRequest)
public static byte[] hash(String text)
public static byte[] hash(byte[] data)
public static String toHex(byte[] data)
Copyright © 2010–2016. All rights reserved.