keyboard-layout-editor/sign-policy.py
Ian Prest a5055e99d5 Can now SAVE layouts to the server.
Implemented as a POST upload to AWS/S3.
-- Each layout is a separate file; identified by its MD5 hash
-- No real security to protect against malicious users "erasing"
layouts, but S3 offers versioning.

Also:
-- Added save button on the toolbar.
-- Added load/save alert boxes.
-- Added Ctrl+S hotkey to save.
2013-10-14 02:08:29 -04:00

17 lines
No EOL
557 B
Python

import base64
import hmac, hashlib
f = open('aws-private-key.txt','rt')
AWS_SECRET_ACCESS_KEY = f.read()
f = open('upload-policy.txt','rt')
policy_document = f.read()
policy_document = policy_document.replace("\n","").replace("\r","").replace("\t","").replace(" ","");
policy = base64.b64encode(policy_document)
signature = base64.b64encode(hmac.new(AWS_SECRET_ACCESS_KEY, policy, hashlib.sha1).digest())
print "Signing Policy:", policy_document
print "Using secret key:", AWS_SECRET_ACCESS_KEY
print
print "Policy:", policy
print "Signature:", signature