Skip to content

Commit 0bb3f49

Browse files
authored
Adding tls_cipher Pref (#749)
1 parent f72b890 commit 0bb3f49

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

awscrt/aws_iot_metrics.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,16 @@ def _minimum_tls_version_metrics_value(version):
207207
def _tls_cipher_preference_metrics_value(pref):
208208
"""Map TlsCipherPref to its single-character metrics value.
209209
210-
Mapping: PQ_TLSv1_0_2021_05->A, PQ_DEFAULT->B, TLSv1_2_2025_07->C.
211-
Returns None for DEFAULT.
210+
Mapping: PQ_TLSv1_0_2021_05->F, PQ_DEFAULT->H, TLSv1_2_2025_07->I.
211+
Letters A-E, G, J, K are reserved for cipher preferences exposed by
212+
other language SDKs but not by Python.
213+
Returns None for DEFAULT or any unrecognized value.
212214
"""
213215
from awscrt.io import TlsCipherPref
214216
mapping = {
215-
TlsCipherPref.PQ_TLSv1_0_2021_05: "A",
216-
TlsCipherPref.PQ_DEFAULT: "B",
217-
TlsCipherPref.TLSv1_2_2025_07: "C",
217+
TlsCipherPref.PQ_TLSv1_0_2021_05: "F",
218+
TlsCipherPref.PQ_DEFAULT: "H",
219+
TlsCipherPref.TLSv1_2_2025_07: "I",
218220
}
219221
return mapping.get(pref)
220222

test/test_aws_iot_metrics.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def test_all_mqtt5_features_set(self):
113113
self.assertIn("H/A", result) # HTTP proxy (no TLS on proxy)
114114
self.assertIn("K/D", result) # TLSv1_2
115115
if cipher_pref.is_supported():
116-
self.assertIn("J/B", result) # PQ_DEFAULT
116+
self.assertIn("J/H", result) # PQ_DEFAULT
117117

118118
def test_alternate_values(self):
119119
"""MQTT5 with alternate non-default values."""
@@ -155,7 +155,7 @@ def test_alternate_values(self):
155155
self.assertIn("H/B", result) # HTTPS proxy
156156
self.assertIn("K/E", result) # TLSv1_3
157157
if cipher_pref.is_supported():
158-
self.assertIn("J/A", result) # PQ_TLSv1_0_2021_05
158+
self.assertIn("J/F", result) # PQ_TLSv1_0_2021_05
159159

160160
def test_mqtt3_with_proxy_and_tls(self):
161161
"""MQTT3 with HTTPS proxy and TLS context."""
@@ -178,7 +178,7 @@ def test_mqtt3_with_proxy_and_tls(self):
178178
self.assertIn("H/B", result) # HTTPS
179179
self.assertIn("K/D", result) # TLSv1_2
180180
if cipher_pref.is_supported():
181-
self.assertIn("J/C", result) # TLSv1_2_2025_07
181+
self.assertIn("J/I", result) # TLSv1_2_2025_07
182182

183183

184184
class TestMergeFeatureLists(NativeResourceTest):

0 commit comments

Comments
 (0)