in demo, only do POP challenge if the challenge type is POP challenge

This commit is contained in:
Seth Schoen 2013-10-31 12:37:44 -07:00
parent 1c5e4e2698
commit f35fb42096

View file

@ -12,13 +12,15 @@ skid, snonce = make_challenge(open("/tmp/pub.pem"))
m.challenge.add(name="what-is-the-frequency", type=m.ProofOfPossession, data=(skid, snonce))
for challenge in m.challenge:
pcr = POPChallengeResponder(*challenge.data)
pcr.find_priv(["/tmp/pub.pem", "/tmp/decoy.pem", "/tmp/falkdjaslkdj", "/tmp/priv.pem"])
assert pcr.privkey
cnonce, sig = pcr.respond_challenge()
r.completedchallenge.add(name=challenge.name, type=r.ProofOfPossession, data=(cnonce,sig))
if challenge.type == m.ProofOfPossession:
pcr = POPChallengeResponder(*challenge.data)
pcr.find_priv(["/tmp/pub.pem", "/tmp/decoy.pem", "/tmp/falkdjaslkdj", "/tmp/priv.pem"])
assert pcr.privkey
cnonce, sig = pcr.respond_challenge()
r.completedchallenge.add(name=challenge.name, type=r.ProofOfPossession, data=(cnonce,sig))
for completedchallenge in r.completedchallenge:
# If there's actually more than one then we'd need to store and use
# multiple different values of snonce.
print verify_challenge_response(open("/tmp/pub.pem").read(), snonce, *completedchallenge.data)
if completedchallenge.type == r.ProofOfPossession:
print verify_challenge_response(open("/tmp/pub.pem").read(), snonce, *completedchallenge.data)