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 ; } }
Computes a signature for the specified string using the HMAC - SHA256 algorithm .