I have tried evote - very nice, I'll try to use it in our school.

In evote/views/default/ballot_verifier.py I found:

# this is the code that verifies the signature
public_key = rsa.PublicKey.load_pkcs1(pk_pem)
if rsa.verify(ballot, signature, public_key)*==None*:
    print 'valid'
else:
    print 'invalid'

But rsa.verify returns True if there is a match and throws an exception if
not.
An invalid public key also throws an exception.

Therefore I think it should be something like

# this is the code that verifies the signature
*try:*
    public_key = rsa.PublicKey.load_pkcs1(pk_pem)
    if rsa.verify(ballot, signature, public_key):
        print 'valid'
    else:                # maybe not necessary
        print 'invalid'  # maybe not necessary
*except:*
    print 'invalid'


​Regards, Martin​

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to