This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// base string - this string will be used to generate mac signature. | |
StringBuilder baseString = new StringBuilder(); | |
/* | |
* The order is CRITICAL! And no "\n" at the end. | |
* | |
* Timestamp + \n + nonce + \n+ httpmethod + \n + | |
* host + \n + path + \n + bodyHash | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.UUID; | |
import javax.crypto.Mac; | |
import javax.crypto.spec.SecretKeySpec; | |
import org.apache.commons.codec.binary.Base64; | |
public class AuthorizationMacHeader { | |
private static final String HMAC_SHA256_ALGORITHM = "HmacSHA256"; | |
private static final String AUTHORIZATION_HEADER_PREFIX = "HMAC-SHA256 "; | |
private static final String KEY_ID_LABEL = "keyid"; |