summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Holth <dholth@fastmail.fm>2013-03-19 22:27:51 -0400
committerDaniel Holth <dholth@fastmail.fm>2013-03-19 22:27:51 -0400
commit93d37dafd5154ddd12213a89a4b300e237e2f7c0 (patch)
tree69e9f9051f7dfc82a2aea30385c3b4abf877f083
parent46bac4cc2f8b93cbac32b000adb16ef8cbeed12b (diff)
downloadwheel-93d37dafd5154ddd12213a89a4b300e237e2f7c0.tar.gz
jwk alg changes to kty in revision -08
-rw-r--r--setup.py2
-rw-r--r--tox.ini2
-rw-r--r--wheel/signatures/__init__.py8
3 files changed, 7 insertions, 5 deletions
diff --git a/setup.py b/setup.py
index 716232d..6f2c552 100644
--- a/setup.py
+++ b/setup.py
@@ -18,7 +18,7 @@ if sys.version_info[:2] < (2, 7):
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=[
diff --git a/tox.ini b/tox.ini
index 034b17d..f5d341e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,7 @@
# and then run "tox" from this directory.
[tox]
-envlist = py26, py27, pypy, py32, py33
+envlist = py27, pypy, py32, py33
[testenv]
commands =
diff --git a/wheel/signatures/__init__.py b/wheel/signatures/__init__.py
index 0839439..3f21b50 100644
--- a/wheel/signatures/__init__.py
+++ b/wheel/signatures/__init__.py
@@ -32,7 +32,7 @@ def sign(payload, keypair):
header = {
"alg": ALG,
"jwk": {
- "alg": ALG,
+ "kty": ALG, # alg -> kty in jwk-08.
"vk": native(urlsafe_b64encode(keypair.vk))
}
}
@@ -70,8 +70,10 @@ def verify(jwsjs):
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)