diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-10-13 14:37:46 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-10-13 14:37:46 +0100 |
commit | 66848557672977e17f0d5ba785b7567b305ccdbe (patch) | |
tree | 0a0bee24bf0dd81559744d13e84eace9fa335972 /synapse/http/client.py | |
parent | SYN-75 sign at the request level rather than the transaction level (diff) | |
download | synapse-66848557672977e17f0d5ba785b7567b305ccdbe.tar.xz |
Verify signatures for server2server requests
Diffstat (limited to 'synapse/http/client.py')
-rw-r--r-- | synapse/http/client.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py index 62fe14fa5e..9f54b74e3a 100644 --- a/synapse/http/client.py +++ b/synapse/http/client.py @@ -177,16 +177,20 @@ class MatrixHttpClient(BaseHttpClient): request = sign_json(request, self.server_name, self.signing_key) + from syutil.jsonutil import encode_canonical_json + logger.debug("Signing " + " " * 11 + "%s %s", + self.server_name, encode_canonical_json(request)) + auth_headers = [] for key,sig in request["signatures"][self.server_name].items(): - auth_headers.append( + auth_headers.append(bytes( "X-Matrix origin=%s,key=\"%s\",sig=\"%s\"" % ( self.server_name, key, sig, ) - ) + )) - headers_dict["Authorization"] = auth_headers + headers_dict[b"Authorization"] = auth_headers @defer.inlineCallbacks def put_json(self, destination, path, data={}, json_data_callback=None): |