PYTHON sample code for the signature calculation
#!/usr/bin/python
# -*- coding: utf-8 -*-
import hashlib
import hmac
import base64
def sign_par(input_par=None, secret=None):
if not input_par or not secret:
raise Exception("Both input_par and secret are required")
# Decode the private key into its binary format
decoded_key = base64.urlsafe_b64decode(secret)
# Create a signature using the private key
# string using HMAC SHA1. This signature will be binary.
signature = hmac.new(decoded_key, input_par.encode('utf-8'), hashlib.sha1)
# Encode the binary signature into base64
encoded_signature = base64.urlsafe_b64encode(signature.digest())
# Return signature
return encoded_signature
if __name__ == "__main__":
input_par = "COMMAND_ITEM_TO_SIGN"
secret = "YOUR_PRIVATE_KEY"
print ("Signature: " + sign_par(input_par, secret).decode('utf-8'))