Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- p = """{"expiration": "2013-01-01T00:00:00Z",
- "conditions": [
- {"bucket": "sam-s3-test-64"},
- ["starts-with", "$key", "upload-"],
- {"acl": "private"},
- ["starts-with", "$Content-Type", ""],
- ["starts-with", "$redirect", ""],
- ["starts-with", "$x-archive-auto-make-bucket", ""],
- ["starts-with", "$x-archive-queue-derive", ""],
- ["content-length-range", 0, 1048576]
- ]
- }"""
- # secret key
- s = "seCr3tk3y"
- import base64
- import hmac, sha
- policy = base64.b64encode(p)
- signature = base64.b64encode(
- hmac.new(s, policy, sha).digest())
- print policy
- print signature
Advertisement
Add Comment
Please, Sign In to add comment