Commits

Daniel Holth committed 5f3d9a7

jwk alg changes to kty in revision -08

Comments (0)

Files changed (3)

     install_requires.append('argparse')
 
 setup(name='wheel',
-      version='1.0.0a1',
+      version='1.0.0a2',
       description='A built-package format for Python.',
       long_description=README + '\n\n' +  CHANGES,
       classifiers=[
 # and then run "tox" from this directory.
 
 [tox]
-envlist = py26, py27, pypy, py32, py33
+envlist = py27, pypy, py32, py33
 
 [testenv]
 commands =

wheel/signatures/__init__.py

     header = {
                 "alg": ALG,
                 "jwk": {
-                    "alg": ALG,
+                    "kty": ALG, # alg -> kty in jwk-08.
                     "vk": native(urlsafe_b64encode(keypair.vk))
                 }
              }
         header = json.loads(native(urlsafe_b64decode(h)))
         assertTrue(header["alg"] == ALG, 
                 "Unexpected algorithm {0}".format(header["alg"]))
-        assertTrue(header["jwk"]["alg"] == ALG, 
-                "Unexpected key algorithm {0}".format(header["jwk"]["alg"]))
+        if "alg" in header["jwk"] and not "kty" in header["jwk"]:
+            header["jwk"]["kty"] = header["jwk"]["alg"] # b/w for JWK < -08
+        assertTrue(header["jwk"]["kty"] == ALG, # true for Ed25519
+                "Unexpected key type {0}".format(header["jwk"]["kty"]))
         vk = urlsafe_b64decode(binary(header["jwk"]["vk"]))
         secured_input = b".".join((h, encoded_payload))
         sig = urlsafe_b64decode(s)