Example usage for org.apache.commons.codec.digest HmacUtils hmacSha384

List of usage examples for org.apache.commons.codec.digest HmacUtils hmacSha384

Introduction

In this page you can find the example usage for org.apache.commons.codec.digest HmacUtils hmacSha384.

Prototype

public static byte[] hmacSha384(final String key, final String valueToDigest) 

Source Link

Document

Returns a HmacSHA384 Message Authentication Code (MAC) for the given key and value.

Usage

From source file:com.vmware.o11n.plugin.crypto.service.CryptoDigestService.java

/**
 * HmacSHA384//from www  .  jav a  2  s. co  m
 *
 * @param keyB64 Secret key Base64 encoded
 * @param dataB64 Data to sign Base64 encoded
 * @return HmacSha384 MAC for the given key and data Base64 encoded
 */
public String hmacSha384(String keyB64, String dataB64) {
    validateB64(keyB64);
    validateB64(dataB64);
    final byte[] key = Base64.decodeBase64(keyB64);
    final byte[] data = Base64.decodeBase64(dataB64);

    return Base64.encodeBase64String(HmacUtils.hmacSha384(key, data));
}