示例#1
0
    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):
        print "SessionStarted"
    else:
        print "Error: couldn't start session."

    print sess.hasSession(pboxid)

    sess.refreshSession(pboxid)
    print sess.hasSession(pboxid)

    sess.finishSession(pboxid)
    print sess.hasSession(pboxid)  #  should return false
    # print "Testing AccessCtrlHandler: "

    # handler = AccessCtrlHandler("rsakeys", "mypass")
    # print handler.handleGetKey()
示例#2
0
    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):
        print "SessionStarted"
    else: print "Error: couldn't start session."


    print sess.hasSession(pboxid)

    sess.refreshSession(pboxid)
    print sess.hasSession(pboxid)

    sess.finishSession(pboxid)
    print sess.hasSession(pboxid) #  should return false
    # print "Testing AccessCtrlHandler: "

    # handler = AccessCtrlHandler("rsakeys", "mypass")
    # print handler.handleGetKey()