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
* { | |
font-size: 12pt; | |
font-family: monospace; | |
font-weight: normal; | |
font-style: normal; | |
text-decoration: none; | |
color: black; | |
cursor: default; | |
} |
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
private static final key = "mailgun_key" | |
public static boolean isSignatureValid(String token , long timestamp, String signature) { | |
try { | |
Mac hmac = Mac.getInstance("HmacSHA256"); | |
SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), "HmacSHA256"); | |
hmac.init(signingKey); | |
String signed = Hex.encodeHexString(hmac.doFinal((timestamp + token).getBytes())); | |
if (signed.equals(signature)) { | |
return true; | |
} |