Below is a sample code part:
ctx =3D SSL.Context(SSL.SSLv23_METHOD)
ctx.load_verify_locations(cafile)
ctx.set_verify(SSL.VERIFY_PEER | SSL.VERIFY_FAIL_IF_NO_PEER_CERT, verify)
s =3D socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ssl =3D SSL.Connection(ctx, s)
ssl.connect((host, 443))
ssl.sendall("GET / HTTP/1.0\r\n\r\n")
at this point, the verify call back works. and if it turned 0 somehow
the execution stops. I want to understand the work logic of
SSL.VERIFY_FAIL_IF_NO_PEER_CERT, verify)
And will be happy if someone send me a sample code for both client and
server side, client side will have a public key and server side will
have both public and private and will be able to check whether this
user is allowed
Just two sample that shows the main logic.
I think it will be helpfull many other beginners like me.
|