MCPcopy Create free account
hub / github.com/s3tools/s3cmd / sign_string_v2

Function sign_string_v2

S3/Crypto.py:66–77  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

64
65### AWS Version 2 signing
66def 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

Callers 3

sign_requestMethod · 0.85
sign_request_v2Function · 0.85
sign_url_base_v2Function · 0.85

Calls 1

encode_to_s3Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…