#client nonce = sid.decryptData(enc_nonce, None) print nonce hash = SHA256.new(nonce) signer = PKCS1_v1_5.new(sid.priv_key) sig2 = signer.sign(hash) print sig2 sig2_enc = sid.encryptData(sig2) #/client print auth.validateNonce(sig2_enc, nonceid, sid.pub_key.exportKey()) print "Testing SessionManager: " pboxid = 26 sess = SessionManager(sid) auth = sess.authm (enc_nonce, nonceid) = auth.generateNonce(sid.pub_key.exportKey()) #client nonce = sid.decryptData(enc_nonce, None) print nonce hash = SHA256.new(nonce) signer = PKCS1_v1_5.new(sid.priv_key) sig2 = signer.sign(hash) print sig2 sig2_enc = sid.encryptData(sig2) #/client if sess.startSession(sig2_enc, nonceid, sid.pub_key.exportKey(), pboxid):
def __init__(self, keys_dirname=0, password=0): self.server = ServerIdentity(keys_dirname, password) self.ticket_manager = TicketManager(self.server) self.session_manager = SessionManager(self.server, self.ticket_manager) self.storage = SafeBoxStorage(self.server)