Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private String getMac(String RequestString, String secretkey) {
- String algorithmName = ‘hmacSHA1′; // the other options are: hmacMD5, hmacSHA256, and hmacSHA512
- Blob input = Blob.valueOf(RequestString);
- Blob signing =Crypto.generateMac(algorithmName, input, secretkey);
- String str=EncodingUtil.urlEncode(EncodingUtil.base64Encode(signing), ‘UTF-8′);
- String str=EncodingUtil.base64Encode(signing);
- string timestamp1 = datetime.now().formatGmt('EEE, d MMM yyyy HH:mm:ss Z');
- String action = 'Action';
- String algorithmName = 'HMACSHA256';
- Blob mac = Crypto.generateMac(algorithmName, Blob.valueOf(timestamp1),
- Blob.valueOf(Secretkey));
- String macUrl =EncodingUtil.base64Encode(mac);
Add Comment
Please, Sign In to add comment