From 0dd530a4d12b7f52b0edd9ce4e8bcfaeeabebc59 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Mon, 24 Nov 2014 13:26:21 +0100 Subject: [PATCH] Fix TODO encode? in create_sig - n, e are `int`s, applied transformations make it `str` - Crypto.Signature.PKCS1_v1_5.new [1] returns PKCS115_SigScheme, and its `sign()` method returns `str` [2] - docs is OK: requires `nonce` to be `str` - `create_sig` is not called with custom `nonce` argument anywhere in the code [1] https://www.dlitz.net/software/pycrypto/api/2.6/Crypto.Signature.PKCS1_v1_5-module.html#new [2] https://www.dlitz.net/software/pycrypto/api/2.6/Crypto.Signature.PKCS1_v1_5.PKCS115_SigScheme-class.html#sign --- letsencrypt/client/crypto_util.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/letsencrypt/client/crypto_util.py b/letsencrypt/client/crypto_util.py index 9185ec2ca..0ba6451b0 100644 --- a/letsencrypt/client/crypto_util.py +++ b/letsencrypt/client/crypto_util.py @@ -58,14 +58,14 @@ def create_sig(msg, key_file, nonce=None, nonce_len=CONFIG.NONCE_SIZE): e_bytes = binascii.unhexlify(leading_zeros(hex(key.e)[2:].replace("L", ""))) return { - "nonce": le_util.jose_b64encode(nonce), # TODO: nonce.encode? + "nonce": le_util.jose_b64encode(nonce), "alg": "RS256", "jwk": { "kty": "RSA", - "n": le_util.jose_b64encode(n_bytes), # TODO: n_bytes.encode? - "e": le_util.jose_b64encode(e_bytes), # TODO: e_bytes.encode? + "n": le_util.jose_b64encode(n_bytes), + "e": le_util.jose_b64encode(e_bytes), }, - "sig": le_util.jose_b64encode(signature), # TODO: signature.encode? + "sig": le_util.jose_b64encode(signature), }