Tabnine Logo
StorageCredentialsAccountAndKey.getHmac256
Code IndexAdd Tabnine to your IDE (free)

How to use
getHmac256
method
in
com.microsoft.azure.storage.StorageCredentialsAccountAndKey

Best Java code snippets using com.microsoft.azure.storage.StorageCredentialsAccountAndKey.getHmac256 (Showing top 2 results out of 315)

origin: com.microsoft.azure/azure-storage

/**
 * Computes a signature for the specified string using the HMAC-SHA256 algorithm.
 * 
 * @param value
 *            The UTF-8-encoded string to sign.
 * 
 * @return A <code>String</code> that contains the HMAC-SHA256-encoded signature.
 * 
 * @throws InvalidKeyException
 *             If the key is not a valid Base64-encoded string.
 */
public static synchronized String computeHmac256(final StorageCredentials creds, final String value) throws InvalidKeyException {
  if (creds.getClass().equals(StorageCredentialsAccountAndKey.class)) {
    byte[] utf8Bytes = null;
    try {
      utf8Bytes = value.getBytes(Constants.UTF8_CHARSET);
    }
    catch (final UnsupportedEncodingException e) {
      throw new IllegalArgumentException(e);
    }
    return Base64.encode(((StorageCredentialsAccountAndKey) creds).getHmac256().doFinal(utf8Bytes));
  }
  else {
    return null;
  }
}
origin: Azure/azure-storage-android

/**
 * Computes a signature for the specified string using the HMAC-SHA256 algorithm.
 * 
 * @param value
 *            The UTF-8-encoded string to sign.
 * 
 * @return A <code>String</code> that contains the HMAC-SHA256-encoded signature.
 * 
 * @throws InvalidKeyException
 *             If the key is not a valid Base64-encoded string.
 */
public static synchronized String computeHmac256(final StorageCredentials creds, final String value) throws InvalidKeyException {
  if (creds.getClass().equals(StorageCredentialsAccountAndKey.class)) {
    byte[] utf8Bytes = null;
    try {
      utf8Bytes = value.getBytes(Constants.UTF8_CHARSET);
    }
    catch (final UnsupportedEncodingException e) {
      throw new IllegalArgumentException(e);
    }
    return Base64.encode(((StorageCredentialsAccountAndKey) creds).getHmac256().doFinal(utf8Bytes));
  }
  else {
    return null;
  }
}
com.microsoft.azure.storageStorageCredentialsAccountAndKeygetHmac256

Javadoc

Gets the HmacSha256 associated with the account key.

Popular methods of StorageCredentialsAccountAndKey

  • <init>
    Creates an instance of the StorageCredentialsAccountAndKey class, using the specified storage accoun
  • updateKey
    Sets the name of the access key to be used when signing the request.
  • exportBase64EncodedKey
    Exports the value of the access key to a Base64-encoded string.
  • getAccountName
    Gets the account name.
  • exportKey
    Exports the value of the access key to an array of bytes.
  • transformUri

Popular in Java

  • Reactive rest calls using spring rest template
  • findViewById (Activity)
  • compareTo (BigDecimal)
  • notifyDataSetChanged (ArrayAdapter)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Kernel (java.awt.image)
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now