Skip to content

Instantly share code, notes, and snippets.

@virtualhobbit
Created July 13, 2020 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save virtualhobbit/5beb4fb28580533ae607c317e703a49a to your computer and use it in GitHub Desktop.
Save virtualhobbit/5beb4fb28580533ae607c317e703a49a to your computer and use it in GitHub Desktop.
// Define the signing key in base64
var kSigningB64 = CryptoEncoding.hexToBase64(attSigningKey);
System.log("The signing key in base64 is: " + kSigningB64);
// Define the string to sign in base 64
var stringToSignB64 = CryptoEncoding.base64Encode(attStringToSign);
System.log("The string to sign in base64 is: " + stringToSignB64);
// Calculate the signature
var signature = CryptoDigest.hmacSha256(kSigningB64, stringToSignB64);
attSignature = CryptoEncoding.base64toHex(signature);
System.log("The signature is: " + attSignature);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment