@@ -46,29 +46,39 @@ use crate::tests::{assert_cert_error_eq, test_provider, verification_time};
46
46
use crate :: Verifier ;
47
47
48
48
// This is the certificate chain presented by one server for
49
- // my.1password.com when this test was updated 2023-08-01. It is
50
- // valid for *.1password.com and 1password.com from
51
- // "Jun 24 00:00:00 2023 GMT" through "Jul 22 23:59:59 2024 GMT".
49
+ // `aws.amazon.com` when this test was updated 2025-08-13.
52
50
//
53
51
// Use this to template view the certificate using OpenSSL:
54
52
// ```sh
55
- // openssl x509 -inform der -text -in 1password_com_valid_1 .crt | less
53
+ // openssl x509 -inform der -text -in aws_amazon_com_valid_1 .crt | less
56
54
// ```
57
55
//
58
- // You can update the cert file with `update_valid_ee_certs .rs`
59
- const VALID_1PASSWORD_COM_CHAIN : & [ & [ u8 ] ] = & [
60
- include_bytes ! ( "1password_com_valid_1 .crt" ) ,
61
- include_bytes ! ( "1password_com_valid_2 .crt" ) ,
62
- include_bytes ! ( "1password_com_valid_3 .crt" ) ,
56
+ // You can update these cert files with `examples/update-certs .rs`
57
+ const VALID_AWS_AMAZON_COM_CHAIN : & [ & [ u8 ] ] = & [
58
+ include_bytes ! ( "aws_amazon_com_valid_1 .crt" ) ,
59
+ include_bytes ! ( "aws_amazon_com_valid_2 .crt" ) ,
60
+ include_bytes ! ( "aws_amazon_com_valid_3 .crt" ) ,
63
61
// XXX: This certificate is included for testing in environments that might need
64
62
// a cross-signed root certificate instead of the just the server-provided one.
65
- include_bytes ! ( "1password_com_valid_4 .crt" ) ,
63
+ include_bytes ! ( "aws_amazon_com_valid_4 .crt" ) ,
66
64
] ;
67
65
68
- const MY_1PASSWORD_COM : & str = "my.1password.com" ;
66
+ #[ cfg( not( any( target_vendor = "apple" , windows) ) ) ]
67
+ const VALID_AWS_NAMES : & [ & str ] = & [
68
+ "aws.amazon.com" ,
69
+ "www.aws.amazon.com" ,
70
+ "aws-us-east-1.amazon.com" ,
71
+ "aws-us-west-2.amazon.com" ,
72
+ "amazonaws-china.com" ,
73
+ "www.amazonaws-china.com" ,
74
+ "1.aws-lbr.amazonaws.com" ,
75
+ ] ;
76
+
77
+ const AWS_AMAZON_COM : & str = "aws.amazon.com" ;
69
78
70
- // A domain name for which `VALID_AWS_AMAZON_COM_CHAIN` isn't valid.
79
+ // Domain names for which `VALID_AWS_AMAZON_COM_CHAIN` isn't valid.
71
80
const VALID_UNRELATED_DOMAIN : & str = "my.1password.com" ;
81
+ const VALID_UNRELATED_SUBDOMAIN : & str = "www.amazon.com" ;
72
82
73
83
const LETSENCRYPT_ORG : & str = "letsencrypt.org" ;
74
84
@@ -167,43 +177,43 @@ fn real_world_test<E: std::error::Error>(test_case: &TestCase<E>) {
167
177
// Prefer to staple the OCSP response for the end-entity certificate for
168
178
// performance and repeatability.
169
179
real_world_test_cases ! {
170
- // The certificate is valid for *.1password .com.
171
- my_1password_com_valid => TestCase {
172
- reference_id: MY_1PASSWORD_COM ,
173
- chain: VALID_1PASSWORD_COM_CHAIN ,
180
+ // The certificate is valid for *.aws.amazon .com.
181
+ aws_amazon_com_valid => TestCase {
182
+ reference_id: AWS_AMAZON_COM ,
183
+ chain: VALID_AWS_AMAZON_COM_CHAIN ,
174
184
stapled_ocsp: None ,
175
185
verification_time: verification_time( ) ,
176
186
expected_result: Ok ( ( ) ) ,
177
187
other_error: no_error!( ) ,
178
188
} ,
179
189
// Same as above but without stapled OCSP.
180
- my_1password_com_valid_no_stapled => TestCase {
181
- reference_id: MY_1PASSWORD_COM ,
182
- chain: VALID_1PASSWORD_COM_CHAIN ,
190
+ aws_amazon_com_valid_no_stapled => TestCase {
191
+ reference_id: AWS_AMAZON_COM ,
192
+ chain: VALID_AWS_AMAZON_COM_CHAIN ,
183
193
stapled_ocsp: None ,
184
194
verification_time: verification_time( ) ,
185
195
expected_result: Ok ( ( ) ) ,
186
196
other_error: no_error!( ) ,
187
197
} ,
188
- // Valid also for 1password. com (no subdomain).
189
- _1password_com_valid => TestCase {
190
- reference_id: "1password .com" ,
191
- chain: VALID_1PASSWORD_COM_CHAIN ,
198
+ // Valid also for www.amazon.amazon. com (extra subdomain).
199
+ _aws_amazon_com_valid => TestCase {
200
+ reference_id: "www.aws.amazon .com" ,
201
+ chain: VALID_AWS_AMAZON_COM_CHAIN ,
192
202
stapled_ocsp: None ,
193
203
verification_time: verification_time( ) ,
194
204
expected_result: Ok ( ( ) ) ,
195
205
other_error: no_error!( ) ,
196
206
} ,
197
207
// The certificate isn't valid for an unrelated subdomain.
198
208
unrelated_domain_invalid => TestCase {
199
- reference_id: VALID_UNRELATED_DOMAIN ,
200
- chain: VALID_1PASSWORD_COM_CHAIN ,
209
+ reference_id: VALID_UNRELATED_SUBDOMAIN ,
210
+ chain: VALID_AWS_AMAZON_COM_CHAIN ,
201
211
stapled_ocsp: None ,
202
212
verification_time: verification_time( ) ,
203
213
#[ cfg( not( any( target_vendor = "apple" , windows) ) ) ]
204
214
expected_result: Err ( TlsError :: InvalidCertificate ( CertificateError :: NotValidForNameContext {
205
- expected: ServerName :: DnsName ( DnsName :: try_from( "agilebits.com" ) . unwrap( ) ) ,
206
- presented: vec! [ "DnsName( \" *.1password.com \" )" . to_owned ( ) , "DnsName( \" 1password.com \" )" . to_owned ( ) ] ,
215
+ expected: ServerName :: DnsName ( DnsName :: try_from( VALID_UNRELATED_SUBDOMAIN ) . unwrap( ) ) ,
216
+ presented: Vec :: from ( VALID_AWS_NAMES ) ,
207
217
} ) ) ,
208
218
#[ cfg( any( target_vendor = "apple" , windows) ) ]
209
219
expected_result: Err ( TlsError :: InvalidCertificate ( CertificateError :: NotValidForName ) ) ,
@@ -212,14 +222,14 @@ real_world_test_cases! {
212
222
// The certificate chain for the unrelated domain is not valid for
213
223
// my.1password.com.
214
224
unrelated_chain_not_valid_for_my_1password_com => TestCase {
215
- reference_id: MY_1PASSWORD_COM ,
216
- chain: VALID_UNRELATED_CHAIN ,
225
+ reference_id: VALID_UNRELATED_DOMAIN ,
226
+ chain: VALID_AWS_AMAZON_COM_CHAIN ,
217
227
stapled_ocsp: None ,
218
228
verification_time: verification_time( ) ,
219
229
#[ cfg( not( any( target_vendor = "apple" , windows) ) ) ]
220
230
expected_result: Err ( TlsError :: InvalidCertificate ( CertificateError :: NotValidForNameContext {
221
- expected: ServerName :: DnsName ( DnsName :: try_from( "my.1password.com" ) . unwrap( ) ) ,
222
- presented: vec! [ "DnsName( \" agilebits.com \" )" . to_owned ( ) , "DnsName( \" www.agilebits.com \" )" . to_owned ( ) ] ,
231
+ expected: ServerName :: DnsName ( DnsName :: try_from( VALID_UNRELATED_DOMAIN ) . unwrap( ) ) ,
232
+ presented: Vec :: from ( VALID_AWS_NAMES ) ,
223
233
} ) ) ,
224
234
#[ cfg( any( target_vendor = "apple" , windows) ) ]
225
235
expected_result: Err ( TlsError :: InvalidCertificate ( CertificateError :: NotValidForName ) ) ,
0 commit comments