mirror of
https://github.com/certbot/certbot.git
synced 2026-08-04 08:03:44 +02:00
get subject public key and use it to encrypt dvsni parameter r as y
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
import web, redis, time
|
import web, redis, time
|
||||||
import CSR
|
import CSR
|
||||||
from Crypto.Hash import SHA256, HMAC
|
from Crypto.Hash import SHA256, HMAC
|
||||||
|
from Crypto.PublicKey import RSA
|
||||||
from Crypto import Random
|
from Crypto import Random
|
||||||
from chocolate_protocol_pb2 import chocolatemessage
|
from chocolate_protocol_pb2 import chocolatemessage
|
||||||
from google.protobuf.message import DecodeError
|
from google.protobuf.message import DecodeError
|
||||||
@@ -102,6 +103,10 @@ class session(object):
|
|||||||
"""Has there already been a signing request made in this session?"""
|
"""Has there already been a signing request made in this session?"""
|
||||||
return sessions.hget(self.id, "state") is not None
|
return sessions.hget(self.id, "state") is not None
|
||||||
|
|
||||||
|
def pubkey(self):
|
||||||
|
"""Return the PEM-formatted subject public key from the CSR."""
|
||||||
|
return CSR.pubkey(sessions.hget(self.id, "csr"))
|
||||||
|
|
||||||
def cert(self):
|
def cert(self):
|
||||||
"""Return the issued certificate."""
|
"""Return the issued certificate."""
|
||||||
return sessions.hget(self.id, "cert")
|
return sessions.hget(self.id, "cert")
|
||||||
@@ -276,8 +281,12 @@ class session(object):
|
|||||||
chall.type = int(c["type"])
|
chall.type = int(c["type"])
|
||||||
chall.name = c["name"]
|
chall.name = c["name"]
|
||||||
chall.succeeded = (c["satisfied"] == "True") # TODO: this contradicts comment in protocol about meaning of "succeeded"
|
chall.succeeded = (c["satisfied"] == "True") # TODO: this contradicts comment in protocol about meaning of "succeeded"
|
||||||
chall.data.append(c["dvsni:r"])
|
# Calculate y
|
||||||
|
dvsni_r = c["dvsni:r"]
|
||||||
|
y = RSA.importKey(self.pubkey()).encrypt(dvsni_r, None)[0]
|
||||||
|
# In dvsni, we send nonce, y, ext
|
||||||
chall.data.append(c["dvsni:nonce"])
|
chall.data.append(c["dvsni:nonce"])
|
||||||
|
chall.data.append(y)
|
||||||
chall.data.append(c["dvsni:ext"])
|
chall.data.append(c["dvsni:ext"])
|
||||||
|
|
||||||
def POST(self):
|
def POST(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user