@@ -883,6 +883,45 @@ def connect():
883883
884884 test_no += 1
885885
886+ print ("Test {0} - good mutual Ed25519 X.509" .format (test_no ))
887+ with open (os .path .join (dir , "clientEd25519Cert.pem" )) as f :
888+ x509EdCert = X509 ().parse (f .read ())
889+ x509EdChain = X509CertChain ([x509EdCert ])
890+ with open (os .path .join (dir , "clientEd25519Key.pem" )) as f :
891+ x509EdKey = parsePEMKey (f .read (), private = True )
892+
893+ synchro .recv (1 )
894+ connection = connect ()
895+ connection .handshakeClientCert (x509EdChain , x509EdKey )
896+ testConnClient (connection )
897+ assert isinstance (connection .session .serverCertChain , X509CertChain )
898+ assert connection .session .serverCertChain .getEndEntityPublicKey ().key_type \
899+ == "Ed25519"
900+ connection .close ()
901+
902+ test_no += 1
903+
904+ print ("Test {0} - good mutual Ed25519 X.509, TLS 1.2" .format (test_no ))
905+ with open (os .path .join (dir , "clientEd25519Cert.pem" )) as f :
906+ x509EdCert = X509 ().parse (f .read ())
907+ x509EdChain = X509CertChain ([x509EdCert ])
908+ with open (os .path .join (dir , "clientEd25519Key.pem" )) as f :
909+ x509EdKey = parsePEMKey (f .read (), private = True )
910+
911+ synchro .recv (1 )
912+ connection = connect ()
913+ settings = HandshakeSettings ()
914+ settings .minVersion = (3 , 3 )
915+ settings .maxVersion = (3 , 3 )
916+ connection .handshakeClientCert (x509EdChain , x509EdKey , settings = settings )
917+ testConnClient (connection )
918+ assert isinstance (connection .session .serverCertChain , X509CertChain )
919+ assert connection .session .serverCertChain .getEndEntityPublicKey ().key_type \
920+ == "Ed25519"
921+ connection .close ()
922+
923+ test_no += 1
924+
886925 print ("Test {0} - good X.509 DSA, SSLv3" .format (test_no ))
887926 synchro .recv (1 )
888927 connection = connect ()
@@ -989,6 +1028,24 @@ def connect():
9891028
9901029 test_no += 1
9911030
1031+ print ("Test {0} - good mutual X.509 Ed25519, PHA, TLSv1.3" .format (test_no ))
1032+ synchro .recv (1 )
1033+ connection = connect ()
1034+ settings = HandshakeSettings ()
1035+ settings .minVersion = (3 , 4 )
1036+ settings .maxVersion = (3 , 4 )
1037+ connection .handshakeClientCert (x509EdChain , x509EdKey , settings = settings )
1038+ synchro .recv (1 )
1039+ b = connection .read (0 , 0 )
1040+ assert b == b''
1041+ testConnClient (connection )
1042+ assert isinstance (connection .session .serverCertChain , X509CertChain )
1043+ assert connection .session .serverCertChain .getEndEntityPublicKey ().key_type \
1044+ == "Ed25519"
1045+ connection .close ()
1046+
1047+ test_no += 1
1048+
9921049 print ("Test {0} - good mutual X.509, PHA and KeyUpdate, TLSv1.3" .format (test_no ))
9931050 synchro .recv (1 )
9941051 connection = connect ()
@@ -2435,6 +2492,36 @@ def connect():
24352492
24362493 test_no += 1
24372494
2495+ print ("Test {0} - good mutual Ed25519 X.509" .format (test_no ))
2496+ synchro .send (b'R' )
2497+ connection = connect ()
2498+ connection .handshakeServer (certChain = x509Ed25519Chain ,
2499+ privateKey = x509Ed25519Key , reqCert = True )
2500+ testConnServer (connection )
2501+ assert (isinstance (connection .session .clientCertChain , X509CertChain ))
2502+ assert connection .session .clientCertChain .getEndEntityPublicKey ().key_type \
2503+ == "Ed25519"
2504+ connection .close ()
2505+
2506+ test_no += 1
2507+
2508+ print ("Test {0} - good mutual Ed25519 X.509, TLS 1.2" .format (test_no ))
2509+ synchro .send (b'R' )
2510+ connection = connect ()
2511+ settings = HandshakeSettings ()
2512+ settings .minVersion = (3 , 3 )
2513+ settings .maxVersion = (3 , 3 )
2514+ connection .handshakeServer (certChain = x509Ed25519Chain ,
2515+ privateKey = x509Ed25519Key , reqCert = True ,
2516+ settings = settings )
2517+ testConnServer (connection )
2518+ assert (isinstance (connection .session .clientCertChain , X509CertChain ))
2519+ assert connection .session .clientCertChain .getEndEntityPublicKey ().key_type \
2520+ == "Ed25519"
2521+ connection .close ()
2522+
2523+ test_no += 1
2524+
24382525 print ("Test {0} - good X.509 DSA, SSLv3" .format (test_no ))
24392526 synchro .send (b'R' )
24402527 connection = connect ()
@@ -2534,6 +2621,29 @@ def connect():
25342621
25352622 test_no += 1
25362623
2624+ print ("Test {0} - good mutual X.509 Ed25519, PHA, TLSv1.3" .format (test_no ))
2625+ synchro .send (b'R' )
2626+ connection = connect ()
2627+ settings = HandshakeSettings ()
2628+ settings .minVersion = (3 , 4 )
2629+ settings .maxVersion = (3 , 4 )
2630+ connection .handshakeServer (certChain = x509Ed25519Chain ,
2631+ privateKey = x509Ed25519Key ,
2632+ settings = settings )
2633+ assert connection .session .clientCertChain is None
2634+ for result in connection .request_post_handshake_auth (settings ):
2635+ assert result in (0 , 1 )
2636+ synchro .send (b'R' )
2637+ testConnServer (connection )
2638+
2639+ assert connection .session .clientCertChain is not None
2640+ assert isinstance (connection .session .clientCertChain , X509CertChain )
2641+ assert connection .session .clientCertChain .getEndEntityPublicKey ().key_type \
2642+ == "Ed25519"
2643+ connection .close ()
2644+
2645+ test_no += 1
2646+
25372647 print ("Test {0} - good mutual X.509, PHA and KeyUpdate, TLSv1.3" .format (test_no ))
25382648 synchro .send (b'R' )
25392649 connection = connect ()
0 commit comments