import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; static byte[] hmacSHA256(byte[] key, byte[] message) ctex { S algorithm = "HmacSHA256"; Mac mac = Mac.getInstance(algorithm); mac.init(new SecretKeySpec(key, algorithm)); ret mac.doFinal(message); }