1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-26 07:41:33 +03:00

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
This commit is contained in:
Jakub Warmuz
2014-11-24 13:26:21 +01:00
parent 882170559d
commit 0dd530a4d1

View File

@@ -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),
}