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

per ENISA report, switched to PKCS#1 PSS signature method

This commit is contained in:
Seth Schoen
2013-10-31 12:39:00 -07:00
parent c5f6ff92eb
commit 74af7a350e

View File

@@ -3,7 +3,7 @@
from pyasn1.type import univ, namedtype
from pyasn1.codec.der import encoder as der_encoder
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from Crypto.Signature import PKCS1_PSS
from Crypto.Hash import SHA, SHA512
from Crypto.Random import random
@@ -74,9 +74,9 @@ class POPChallengeResponder(object):
return None
to_sign = "chocolate protocol %s %s" % (self.nonce, self.server_nonce)
# XXX TODO What is an appropriate and safe RSA signature algorithm to
# use for creating signatures? Is the use of PKCS#1 1.5 with SHA-512
# use for creating signatures? Is the use of PKCS#1 PSS with SHA-512
# safe? Is this implementation free of timing attacks?
sig = PKCS1_v1_5.new(self.privkey).sign(SHA512.new(to_sign))
sig = PKCS1_PSS.new(self.privkey).sign(SHA512.new(to_sign))
# Try to forget the private key now that it's been used.
self.privkey = None
return (self.nonce, sig)
@@ -100,4 +100,4 @@ def verify_challenge_response(pubkey, challenge_string, client_nonce, sig):
except:
return False
text = "chocolate protocol %s %s" % (client_nonce, challenge_string)
return PKCS1_v1_5.new(key).verify(SHA512.new(text), sig)
return PKCS1_PSS.new(key).verify(SHA512.new(text), sig)