0
def cert_check(conn,cert,errnum,depth,ok):
print 'Got cert',cert.get_subject()
return ok
ctx = SSL.context(SSL.TLSv1_METHOD)
ctx.set_verify(SSL.VERIFY_PEER,verify_cb)
ctx.use_private_key_file('server.key')
ctx.use_certificate_file('server.crt')
ctx.load_verify_locations('ca.crt')
客戶:
ctx = SSL.context(SSL.TLSv1_METHOD)
ctx.set_verify(SSL.VERIFY_PEER,verify_cb)
ctx.use_private_key_file('client.key')
ctx.use_certificate_file('client.crt')
ctx.load_verify_locations('ca.crt')
它是如何在客戶端和服務器端,我得到兩個證書。一個沒有CommonName,一個沒有正確的CommonName = myownserver.com/myownclient.com
所有上述文件只有一個密鑰/證書。 此外,我猜測第一個打印的證書是ca.crt,因爲它是沒有任何CommonName的唯一證書。但爲什麼會發生?