Package org.restlet.ext.crypto.internal
Class AwsUtils
- java.lang.Object
-
- org.restlet.ext.crypto.internal.AwsUtils
-
public class AwsUtils extends java.lang.ObjectProvides utility functions for implementing the Amazon S3 Authentication scheme.- See Also:
- Authenticating REST Requests
-
-
Constructor Summary
Constructors Constructor Description AwsUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetCanonicalizedAmzHeaders(Series<Header> requestHeaders)Returns the canonicalized AMZ headers.static java.lang.StringgetCanonicalizedResourceName(Reference reference)Returns the canonicalized resource name.static java.lang.StringgetHmacSha1Signature(java.lang.String stringToSign, char[] secret)Returns the AWS authentication compatible signature for the given string to sign and secret.static java.lang.StringgetHmacSha256Signature(java.lang.String stringToSign, char[] secret)Returns the AWS authentication compatible signature for the given string to sign and secret.static java.lang.StringgetQuerySignature(Method method, Reference resourceRef, java.util.List<Parameter> params, char[] secret)Returns the AWS SimpleDB authentication compatible signature for the given request and secret.static java.lang.StringgetQueryStringToSign(Method method, Reference resourceRef, java.util.List<Parameter> params)Returns the SimpleDB string to sign.static java.lang.StringgetS3Signature(Request request, char[] secret)Returns the AWS S3 authentication compatible signature for the given request and secret.static java.lang.StringgetS3Signature(Request request, Series<Header> headers, char[] secret)Returns the AWS S3 authentication compatible signature for the given request and secret.static java.lang.StringgetS3StringToSign(Request request)Returns the string to sign.static java.lang.StringgetS3StringToSign(Request request, Series<Header> headers)Returns the S3 string to sign.
-
-
-
Method Detail
-
getCanonicalizedAmzHeaders
public static java.lang.String getCanonicalizedAmzHeaders(Series<Header> requestHeaders)
Returns the canonicalized AMZ headers.- Parameters:
requestHeaders- The list of request headers.- Returns:
- The canonicalized AMZ headers.
-
getCanonicalizedResourceName
public static java.lang.String getCanonicalizedResourceName(Reference reference)
Returns the canonicalized resource name.- Parameters:
reference- The resource reference- Returns:
- The canonicalized resource name.
-
getHmacSha1Signature
public static java.lang.String getHmacSha1Signature(java.lang.String stringToSign, char[] secret)Returns the AWS authentication compatible signature for the given string to sign and secret.- Parameters:
stringToSign- The string to sign.secret- The user secret to sign with- Returns:
- The AWS compatible signature
-
getHmacSha256Signature
public static java.lang.String getHmacSha256Signature(java.lang.String stringToSign, char[] secret)Returns the AWS authentication compatible signature for the given string to sign and secret.- Parameters:
stringToSign- The string to sign.secret- The user secret to sign with- Returns:
- The AWS compatible signature
-
getQuerySignature
public static java.lang.String getQuerySignature(Method method, Reference resourceRef, java.util.List<Parameter> params, char[] secret)
Returns the AWS SimpleDB authentication compatible signature for the given request and secret.- Parameters:
method- The request method.resourceRef- The target resource reference.params- The request parameters.secret- The user secret to sign with- Returns:
- The AWS SimpleDB compatible signature
-
getQueryStringToSign
public static java.lang.String getQueryStringToSign(Method method, Reference resourceRef, java.util.List<Parameter> params)
Returns the SimpleDB string to sign.- Parameters:
resourceRef- The target resource reference.- Returns:
- The string to sign.
-
getS3Signature
public static java.lang.String getS3Signature(Request request, char[] secret)
Returns the AWS S3 authentication compatible signature for the given request and secret.- Parameters:
request- The request to create the signature forsecret- The user secret to sign with- Returns:
- The AWS S3 compatible signature
-
getS3Signature
public static java.lang.String getS3Signature(Request request, Series<Header> headers, char[] secret)
Returns the AWS S3 authentication compatible signature for the given request and secret.- Parameters:
request- The request to create the signature forheaders- The HTTP headers associated with the requestsecret- The user secret to sign with- Returns:
- The AWS S3 compatible signature
-
getS3StringToSign
public static java.lang.String getS3StringToSign(Request request)
Returns the string to sign.- Parameters:
request- The request to generate the signature string from- Returns:
- The string to sign
-
-