use M2Crypto for encrypting (Crypto.PublicKey uses unpaded RSA\!)

This commit is contained in:
Eric Wustrow 2012-07-12 14:54:39 -04:00
parent e8f90a631a
commit a6f244ec76

View file

@ -300,7 +300,8 @@ class session(object):
chall.succeeded = (c["satisfied"] == "True") # TODO: this contradicts comment in protocol about meaning of "succeeded"
# Calculate y
dvsni_r = c["dvsni:r"]
y = RSA.importKey(self.pubkey()).encrypt(dvsni_r, None)[0]
pubkey = M2Crypto.RSA.load_key_string(self.pubkey())
y = pubkey.public_encrypt(dvsni_r, M2Crypto.RSA.pkcs1_oaep_padding)
# In dvsni, we send nonce, y, ext
chall.data.append(c["dvsni:nonce"])
chall.data.append(y)