Commits

Anonymous committed a916fdc

Incorporate bugfixes from upstream.

  • Participants
  • Parent commits 87de13c

Comments (0)

Files changed (1)

File lib/openid2rp.py

     def do_meta(self, attrs):
         attrs = dict(attrs)
         # Yadis 6.2.5 option 1: meta tag
-        if attrs['http-equiv'].lower() == 'x-xrds-location':
+        if attrs.get('http-equiv','').lower() == 'x-xrds-location':
             self.xrds_location = attrs['content']
 
 def discover(url):
     if 'error' in data:
         raise ValueError, "associate failed: "+data['error']
     if url.startswith('http:'):
+        enc_mac_key = data.get('enc_mac_key')
+        if not enc_mac_key:
+            raise ValueError, "Provider protocol error: not using DH-SHA1"
         enc_mac_key = base64.b64decode(data['enc_mac_key'])
         dh_server_public = unbtwoc(base64.b64decode(data['dh_server_public']))
         # shared secret: sha1(2^(server_priv*priv) mod prime) xor enc_mac_key