public final class StorageCredentialsHelper extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
canCredentialsGenerateClient(StorageCredentials creds)
RESERVED, for internal use only.
|
static boolean |
canCredentialsSignRequest(StorageCredentials creds)
RESERVED, for internal use only.
|
static String |
computeHmac256(StorageCredentials creds,
String value)
Computes a signature for the specified string using the HMAC-SHA256 algorithm.
|
static void |
signBlobQueueAndFileRequest(StorageCredentials creds,
HttpURLConnection request,
long contentLength,
OperationContext opContext)
Signs a request using the specified operation context under the Shared Key authentication scheme.
|
static void |
signTableRequest(StorageCredentials creds,
HttpURLConnection request,
long contentLength,
OperationContext opContext)
Signs a request using the specified operation context under the Shared Key authentication scheme.
|
public static boolean canCredentialsSignRequest(StorageCredentials creds)
true
if a request can be signed with these
credentials; otherwise, false
public static boolean canCredentialsGenerateClient(StorageCredentials creds)
true
if a client can be generated with these
credentials; otherwise, false
public static String computeHmac256(StorageCredentials creds, String value) throws InvalidKeyException
value
- The UTF-8-encoded string to sign.String
that contains the HMAC-SHA256-encoded signature.InvalidKeyException
- If the key is not a valid Base64-encoded string.public static void signBlobQueueAndFileRequest(StorageCredentials creds, HttpURLConnection request, long contentLength, OperationContext opContext) throws InvalidKeyException, StorageException
request
- An HttpURLConnection
object that represents the request to sign.contentLength
- The length of the content written to the output stream. If unknown, specify -1.opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.InvalidKeyException
- If the given key is invalid.StorageException
- If a storage service error occurred.public static void signTableRequest(StorageCredentials creds, HttpURLConnection request, long contentLength, OperationContext opContext) throws InvalidKeyException, StorageException
request
- An HttpURLConnection
object that represents the request to sign.contentLength
- The length of the content written to the output stream. If unknown, specify -1.opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.InvalidKeyException
- If the given key is invalid.StorageException
- If a storage service error occurred.Copyright © 2019. All rights reserved.