summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorDavid Baker <dbkr@matrix.org>2014-09-24 15:29:24 +0200
committerDavid Baker <dbkr@matrix.org>2014-09-24 15:29:24 +0200
commitb42b0d3fe527313f7885ec3ac5e582a59c2c07fb (patch)
tree56935de5734a8f72477cc02123be396cc568cf89 /synapse
parentThe config is not hierarchical (diff)
downloadsynapse-b42b0d3fe527313f7885ec3ac5e582a59c2c07fb.tar.xz
Use standard base64 encoding with padding to get the same result as
coturn.
Diffstat (limited to 'synapse')
-rw-r--r--synapse/rest/voip.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/rest/voip.py b/synapse/rest/voip.py
index 1989a322cf..bb0108cbd1 100644
--- a/synapse/rest/voip.py
+++ b/synapse/rest/voip.py
@@ -17,10 +17,10 @@ from twisted.internet import defer
 
 from base import RestServlet, client_path_pattern
 
-from syutil.base64util import encode_base64
 
 import hmac
 import hashlib
+import base64
 
 
 class VoipRestServlet(RestServlet):
@@ -40,7 +40,10 @@ class VoipRestServlet(RestServlet):
         username = "%d:%s" % (expiry, auth_user.to_string())
          
         mac = hmac.new(turnSecret, msg=username, digestmod=hashlib.sha1)
-        password = encode_base64(mac.digest())
+        # We need to use standard base64 encoding here, *not* syutil's encode_base64
+        # because we need to add the standard padding to get the same result as the
+        # TURN server.
+        password = base64.b64encode(mac.digest())
 
         defer.returnValue( (200, {
             'username': username,