Apache CXF API

org.apache.cxf.rs.security.oauth2.tokens.mac
Class HmacUtils

java.lang.Object
  extended by org.apache.cxf.rs.security.oauth2.tokens.mac.HmacUtils

public final class HmacUtils
extends Object


Method Summary
static byte[] computeHmac(String key, HmacAlgorithm algo, String data)
          Computes HMAC value using the given parameters.
static byte[] computeHmac(String key, String macAlgoJavaName, String data)
          Computes HMAC value using the given parameters.
static String computeHmacString(String macSecret, String macAlgoJavaName, String data)
          Computes HMAC value using the given parameters.
static String computeSignature(String macAlgoOAuthName, String macSecret, String data)
           
static String generateSecret(HmacAlgorithm algo)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

computeSignature

public static String computeSignature(String macAlgoOAuthName,
                                      String macSecret,
                                      String data)

computeHmacString

public static String computeHmacString(String macSecret,
                                       String macAlgoJavaName,
                                       String data)
Computes HMAC value using the given parameters.

Parameters:
macSecret -
macAlgorithm - Should be one of HmacSHA1 or HmacSHA256
data -
Returns:
Base64 encoded string representation of the computed hmac value

computeHmac

public static byte[] computeHmac(String key,
                                 HmacAlgorithm algo,
                                 String data)
Computes HMAC value using the given parameters.

Parameters:
macKey -
macAlgorithm -
data -
Returns:
Computed HMAC value.

computeHmac

public static byte[] computeHmac(String key,
                                 String macAlgoJavaName,
                                 String data)
Computes HMAC value using the given parameters.

Parameters:
macKey -
macAlgorithm -
data -
Returns:
Computed HMAC value.

generateSecret

public static String generateSecret(HmacAlgorithm algo)

Apache CXF API

Apache CXF