6161 ZeroRttStatus ,
6262 KexHashFuncStatus ,
6363 CipherOrderStatus ,
64+ KexRSAPKCSStatus ,
6465)
6566from checks .resolver import dns_resolve_tlsa , DNSSECStatus , dns_resolve_a
6667from checks .tasks .tls import TLSException
7172 KeyExchangeHashFunctionEvaluation ,
7273 TLSCipherOrderEvaluation ,
7374 TLSOCSPEvaluation ,
75+ KeyExchangeRSAPKCSFunctionEvaluation ,
7476)
7577from checks .tasks .tls .tls_constants import (
7678 CERT_SIGALG_GOOD ,
8284 CERT_RSA_MIN_PHASE_OUT_KEY_SIZE ,
8385 SIGNATURE_ALGORITHMS_BAD_HASH ,
8486 SIGNATURE_ALGORITHMS_PHASE_OUT_HASH ,
87+ SIGNATURE_ALGORITHMS_RSA_PKCS ,
8588)
8689from internetnl import log
8790
@@ -604,24 +607,21 @@ def check_mail_tls(result: ServerScanResult, all_suites: List[CipherSuitesScanAt
604607 protocol_evaluation = TLSProtocolEvaluation .from_protocols_accepted (prots_accepted )
605608 fs_evaluation = TLSForwardSecrecyParameterEvaluation .from_ciphers_accepted (ciphers_accepted )
606609 cipher_evaluation = TLSCipherEvaluation .from_ciphers_accepted (ciphers_accepted )
610+
611+ server_conn_info = ServerConnectivityInfo (
612+ server_location = result .server_location ,
613+ network_configuration = result .network_configuration ,
614+ tls_probing_result = result .connectivity_result ,
615+ )
607616 cipher_order_evaluation = test_cipher_order (
608- ServerConnectivityInfo (
609- server_location = result .server_location ,
610- network_configuration = result .network_configuration ,
611- tls_probing_result = result .connectivity_result ,
612- ),
617+ server_conn_info ,
613618 prots_accepted ,
614619 cipher_evaluation ,
615620 )
616- cert_results = cert_checks (result .server_location .hostname , ChecksMode .MAIL )
621+ key_exchange_rsa_pkcs_evaluation = test_key_exchange_rsa_pkcs (server_conn_info )
622+ key_exchange_hash_evaluation = test_key_exchange_hash (server_conn_info )
617623
618- key_exchange_hash_evaluation = test_key_exchange_hash (
619- ServerConnectivityInfo (
620- server_location = result .server_location ,
621- network_configuration = result .network_configuration ,
622- tls_probing_result = result .connectivity_result ,
623- ),
624- )
624+ cert_results = cert_checks (result .server_location .hostname , ChecksMode .MAIL )
625625
626626 # HACK for DANE-TA(2) and hostname mismatch!
627627 # Give a good hosmatch score if DANE-TA *is not* present.
@@ -677,6 +677,8 @@ def check_mail_tls(result: ServerScanResult, all_suites: List[CipherSuitesScanAt
677677 if result .scan_result .tls_1_3_early_data .result .supports_early_data
678678 else scoring .WEB_TLS_ZERO_RTT_GOOD
679679 ),
680+ key_exchange_rsa_pkcs = key_exchange_rsa_pkcs_evaluation .status ,
681+ key_exchange_rsa_pkcs_score = key_exchange_rsa_pkcs_evaluation .score ,
680682 kex_hash_func = key_exchange_hash_evaluation .status ,
681683 kex_hash_func_score = key_exchange_hash_evaluation .score ,
682684 )
@@ -735,22 +737,19 @@ def check_web_tls(url, af_ip_pair=None, *args, **kwargs):
735737 protocol_evaluation = TLSProtocolEvaluation .from_protocols_accepted (supported_tls_versions )
736738 fs_evaluation = TLSForwardSecrecyParameterEvaluation .from_ciphers_accepted (ciphers_accepted )
737739 cipher_evaluation = TLSCipherEvaluation .from_ciphers_accepted (ciphers_accepted )
740+
741+ server_conn_info = ServerConnectivityInfo (
742+ server_location = result .server_location ,
743+ network_configuration = result .network_configuration ,
744+ tls_probing_result = result .connectivity_result ,
745+ )
738746 cipher_order_evaluation = test_cipher_order (
739- ServerConnectivityInfo (
740- server_location = result .server_location ,
741- network_configuration = result .network_configuration ,
742- tls_probing_result = result .connectivity_result ,
743- ),
747+ server_conn_info ,
744748 supported_tls_versions ,
745749 cipher_evaluation ,
746750 )
747- key_exchange_hash_evaluation = test_key_exchange_hash (
748- ServerConnectivityInfo (
749- server_location = result .server_location ,
750- network_configuration = result .network_configuration ,
751- tls_probing_result = result .connectivity_result ,
752- ),
753- )
751+ key_exchange_rsa_pkcs_evaluation = test_key_exchange_rsa_pkcs (server_conn_info )
752+ key_exchange_hash_evaluation = test_key_exchange_hash (server_conn_info )
754753
755754 ocsp_evaluation = TLSOCSPEvaluation .from_certificate_deployments (
756755 result .scan_result .certificate_info .result .certificate_deployments [0 ]
@@ -804,6 +803,8 @@ def check_web_tls(url, af_ip_pair=None, *args, **kwargs):
804803 ),
805804 ocsp_stapling = ocsp_evaluation .status ,
806805 ocsp_stapling_score = ocsp_evaluation .score ,
806+ key_exchange_rsa_pkcs = key_exchange_rsa_pkcs_evaluation .status ,
807+ key_exchange_rsa_pkcs_score = key_exchange_rsa_pkcs_evaluation .score ,
807808 kex_hash_func = key_exchange_hash_evaluation .status ,
808809 kex_hash_func_score = key_exchange_hash_evaluation .score ,
809810 )
@@ -863,6 +864,27 @@ def raise_sslyze_errors(result: ServerScanResult) -> None:
863864 raise TLSException (str (last_error_trace ))
864865
865866
867+ def test_key_exchange_rsa_pkcs (
868+ server_connectivity_info : ServerConnectivityInfo ,
869+ ) -> KeyExchangeRSAPKCSFunctionEvaluation :
870+ """
871+ Test key exchange for RSA PKCS support per NCSC 3.3.2.1.
872+ See also RFC8446 1.3 and 4.2.3, RFC 5246 7.4.1.4.1.
873+ """
874+ rsa_pkcs_result = _test_connection_with_limited_sigalgs (server_connectivity_info , SIGNATURE_ALGORITHMS_RSA_PKCS )
875+ if rsa_pkcs_result :
876+ log .info (f"RSA-PKCS key exchange check: negotiated bad sigalg ({ rsa_pkcs_result } )" )
877+ return KeyExchangeRSAPKCSFunctionEvaluation (
878+ status = KexRSAPKCSStatus .bad ,
879+ score = scoring .WEB_TLS_KEX_RSA_PKCS_BAD ,
880+ )
881+
882+ return KeyExchangeRSAPKCSFunctionEvaluation (
883+ status = KexRSAPKCSStatus .good ,
884+ score = scoring .WEB_TLS_KEX_RSA_PKCS_GOOD ,
885+ )
886+
887+
866888def test_key_exchange_hash (
867889 server_connectivity_info : ServerConnectivityInfo ,
868890) -> KeyExchangeHashFunctionEvaluation :
@@ -873,7 +895,7 @@ def test_key_exchange_hash(
873895 """
874896 bad_hash_result = _test_connection_with_limited_sigalgs (server_connectivity_info , SIGNATURE_ALGORITHMS_BAD_HASH )
875897 if bad_hash_result :
876- log .info (f"SHA2 key exchange check: negotiated bad hash ({ bad_hash_result } )" )
898+ log .info (f"SHA2 key exchange check: negotiated bad sigalg ({ bad_hash_result } )" )
877899 return KeyExchangeHashFunctionEvaluation (
878900 status = KexHashFuncStatus .bad ,
879901 score = scoring .WEB_TLS_KEX_HASH_FUNC_BAD ,
0 commit comments