@@ -243,6 +243,7 @@ def _builder(
243243 use_websockets = False ,
244244 websocket_handshake_transform = None ,
245245 use_custom_authorizer = False ,
246+ cipher_pref = awscrt .io .TlsCipherPref .DEFAULT ,
246247 ** kwargs ):
247248
248249 username = _get (kwargs , 'username' , '' )
@@ -345,6 +346,9 @@ def _builder(
345346 elif ca_filepath or ca_dirpath :
346347 tls_ctx_options .override_default_trust_store_from_path (ca_dirpath , ca_filepath )
347348
349+ if cipher_pref is not None :
350+ tls_ctx_options .cipher_pref = cipher_pref
351+
348352 if client_options .port is None :
349353 # prefer 443, even for direct MQTT connections, since it's less likely to be blocked by firewalls
350354 if use_websockets or awscrt .io .is_alpn_available ():
@@ -362,7 +366,7 @@ def _builder(
362366 return client
363367
364368
365- def mtls_from_path (cert_filepath , pri_key_filepath , cipher_pref = awscrt . io . TlsCipherPref . DEFAULT ,
369+ def mtls_from_path (cert_filepath , pri_key_filepath ,
366370 ** kwargs ) -> awscrt .mqtt5 .Client :
367371 """
368372 This builder creates an :class:`awscrt.mqtt5.Client`, configured for an mTLS MQTT5 Client to AWS IoT.
@@ -378,14 +382,12 @@ def mtls_from_path(cert_filepath, pri_key_filepath, cipher_pref=awscrt.io.TlsCip
378382 """
379383 _check_required_kwargs (** kwargs )
380384 tls_ctx_options = awscrt .io .TlsContextOptions .create_client_with_mtls_from_path (cert_filepath , pri_key_filepath )
381- tls_ctx_options .cipher_pref = cipher_pref
382385 return _builder (tls_ctx_options , ** kwargs )
383386
384387
385388def mtls_from_bytes (
386389 cert_bytes ,
387390 pri_key_bytes ,
388- cipher_pref = awscrt .io .TlsCipherPref .DEFAULT ,
389391 ** kwargs ) -> awscrt .mqtt5 .Client :
390392 """
391393 This builder creates an :class:`awscrt.mqtt5.Client`, configured for an mTLS MQTT5 Client to AWS IoT.
@@ -401,7 +403,6 @@ def mtls_from_bytes(
401403 """
402404 _check_required_kwargs (** kwargs )
403405 tls_ctx_options = awscrt .io .TlsContextOptions .create_client_with_mtls (cert_bytes , pri_key_bytes )
404- tls_ctx_options .cipher_pref = cipher_pref
405406 return _builder (tls_ctx_options , ** kwargs )
406407
407408
@@ -413,7 +414,6 @@ def mtls_with_pkcs11(*,
413414 private_key_label : str = None ,
414415 cert_filepath : str = None ,
415416 cert_bytes = None ,
416- cipher_pref = awscrt .io .TlsCipherPref .DEFAULT ,
417417 ** kwargs ) -> awscrt .mqtt5 .Client :
418418 """
419419 This builder creates an :class:`awscrt.mqtt5.Client`, configured for an mTLS MQTT connection to AWS IoT,
@@ -459,14 +459,12 @@ def mtls_with_pkcs11(*,
459459 private_key_label = private_key_label ,
460460 cert_file_path = cert_filepath ,
461461 cert_file_contents = cert_bytes )
462- tls_ctx_options .cipher_pref = cipher_pref
463462 return _builder (tls_ctx_options , ** kwargs )
464463
465464
466465def mtls_with_pkcs12 (* ,
467466 pkcs12_filepath : str ,
468467 pkcs12_password : str ,
469- cipher_pref = awscrt .io .TlsCipherPref .DEFAULT ,
470468 ** kwargs ) -> awscrt .mqtt .Connection :
471469 """
472470 This builder creates an :class:`awscrt.mqtt.Connection`, configured for an mTLS MQTT connection to AWS IoT,
@@ -487,13 +485,11 @@ def mtls_with_pkcs12(*,
487485 tls_ctx_options = awscrt .io .TlsContextOptions .create_client_with_mtls_pkcs12 (
488486 pkcs12_filepath = pkcs12_filepath ,
489487 pkcs12_password = pkcs12_password )
490- tls_ctx_options .cipher_pref = cipher_pref
491488 return _builder (tls_ctx_options , ** kwargs )
492489
493490
494491def mtls_with_windows_cert_store_path (* ,
495492 cert_store_path : str ,
496- cipher_pref = awscrt .io .TlsCipherPref .DEFAULT ,
497493 ** kwargs ) -> awscrt .mqtt5 .Client :
498494 """
499495 This builder creates an :class:`awscrt.mqtt5.Client`, configured for an mTLS MQTT5 Client to AWS IoT,
@@ -512,15 +508,13 @@ def mtls_with_windows_cert_store_path(*,
512508 _check_required_kwargs (** kwargs )
513509
514510 tls_ctx_options = awscrt .io .TlsContextOptions .create_client_with_mtls_windows_cert_store_path (cert_store_path )
515- tls_ctx_options .cipher_pref = cipher_pref
516511 return _builder (tls_ctx_options , ** kwargs )
517512
518513
519514def websockets_with_default_aws_signing (
520515 region ,
521516 credentials_provider ,
522517 websocket_proxy_options = None ,
523- cipher_pref = awscrt .io .TlsCipherPref .DEFAULT ,
524518 ** kwargs ) -> awscrt .mqtt5 .Client :
525519 """
526520 This builder creates an :class:`awscrt.mqtt5.Client`, configured for an MQTT5 Client over websockets to AWS IoT.
@@ -560,15 +554,13 @@ def _sign_websocket_handshake_request(transform_args, **kwargs):
560554
561555 return websockets_with_custom_handshake (
562556 _sign_websocket_handshake_request ,
563- websocket_proxy_options = websocket_proxy_options ,
564- cipher_pref = cipher_pref ,
557+ websocket_proxy_options ,
565558 ** kwargs )
566559
567560
568561def websockets_with_custom_handshake (
569562 websocket_handshake_transform ,
570563 websocket_proxy_options = None ,
571- cipher_pref = awscrt .io .TlsCipherPref .DEFAULT ,
572564 ** kwargs ) -> awscrt .mqtt5 .Client :
573565 """
574566 This builder creates an :class:`awscrt.mqtt5.Client`, configured for an MQTT5 Client over websockets,
@@ -596,7 +588,6 @@ def websockets_with_custom_handshake(
596588 """
597589 _check_required_kwargs (** kwargs )
598590 tls_ctx_options = awscrt .io .TlsContextOptions ()
599- tls_ctx_options .cipher_pref = cipher_pref
600591 return _builder (tls_ctx_options = tls_ctx_options ,
601592 use_websockets = True ,
602593 websocket_handshake_transform = websocket_handshake_transform ,
@@ -628,7 +619,6 @@ def direct_with_custom_authorizer(
628619 auth_password = None ,
629620 auth_token_key_name = None ,
630621 auth_token_value = None ,
631- cipher_pref = awscrt .io .TlsCipherPref .DEFAULT ,
632622 ** kwargs ) -> awscrt .mqtt5 .Client :
633623 """
634624 This builder creates an :class:`awscrt.mqtt5.Client`, configured for an MQTT5 Client using a custom
@@ -695,7 +685,6 @@ def direct_with_custom_authorizer(
695685
696686 tls_ctx_options = awscrt .io .TlsContextOptions ()
697687 tls_ctx_options .alpn_list = ["mqtt" ]
698- tls_ctx_options .cipher_pref = cipher_pref
699688
700689 return _builder (tls_ctx_options = tls_ctx_options ,
701690 use_websockets = False ,
@@ -711,7 +700,6 @@ def websockets_with_custom_authorizer(
711700 websocket_proxy_options = None ,
712701 auth_token_key_name = None ,
713702 auth_token_value = None ,
714- cipher_pref = awscrt .io .TlsCipherPref .DEFAULT ,
715703 ** kwargs ) -> awscrt .mqtt5 .Client :
716704 """
717705 This builder creates an :class:`awscrt.mqtt5.Client`, configured for an MQTT5 Client using a custom
@@ -781,7 +769,6 @@ def websockets_with_custom_authorizer(
781769 kwargs ["password" ] = auth_password
782770
783771 tls_ctx_options = awscrt .io .TlsContextOptions ()
784- tls_ctx_options .cipher_pref = cipher_pref
785772
786773 def _sign_websocket_handshake_request (transform_args , ** kwargs ):
787774 # transform_args need to know when transform is done
@@ -798,7 +785,7 @@ def _sign_websocket_handshake_request(transform_args, **kwargs):
798785 ** kwargs )
799786
800787
801- def new_default_builder (cipher_pref = awscrt . io . TlsCipherPref . DEFAULT , ** kwargs ) -> awscrt .mqtt5 .Client :
788+ def new_default_builder (** kwargs ) -> awscrt .mqtt5 .Client :
802789 """
803790 This builder creates an :class:`awscrt.mqtt5.Client`, without any configuration besides the default TLS context options.
804791
@@ -807,7 +794,6 @@ def new_default_builder(cipher_pref=awscrt.io.TlsCipherPref.DEFAULT, **kwargs) -
807794 """
808795 _check_required_kwargs (** kwargs )
809796 tls_ctx_options = awscrt .io .TlsContextOptions ()
810- tls_ctx_options .cipher_pref = cipher_pref
811797 return _builder (tls_ctx_options = tls_ctx_options ,
812798 use_websockets = False ,
813799 ** kwargs )
0 commit comments