Sign a string with the secret key, returning base64 encoded results. By default the configured secret key is used, but may be overridden as an argument. Useful for REST authentication. See http://s3.amazonaws.com/doc/s3-developer-guide/RESTAuthentication.html string_to_sign should b
(string_to_sign)
| 64 | |
| 65 | ### AWS Version 2 signing |
| 66 | def sign_string_v2(string_to_sign): |
| 67 | """Sign a string with the secret key, returning base64 encoded results. |
| 68 | By default the configured secret key is used, but may be overridden as |
| 69 | an argument. |
| 70 | |
| 71 | Useful for REST authentication. See http://s3.amazonaws.com/doc/s3-developer-guide/RESTAuthentication.html |
| 72 | string_to_sign should be utf-8 "bytes". |
| 73 | and returned signature will be utf-8 encoded "bytes". |
| 74 | """ |
| 75 | secret_key = Config.Config().secret_key |
| 76 | signature = encodestring(hmac.new(encode_to_s3(secret_key), string_to_sign, sha1).digest()).strip() |
| 77 | return signature |
| 78 | __all__.append("sign_string_v2") |
| 79 | |
| 80 |
no test coverage detected
searching dependent graphs…