@@ -46,29 +46,39 @@ use crate::tests::{assert_cert_error_eq, test_provider, verification_time};
4646use crate :: Verifier ;
4747
4848// 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.
5250//
5351// Use this to template view the certificate using OpenSSL:
5452// ```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
5654// ```
5755//
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" ) ,
6361 // XXX: This certificate is included for testing in environments that might need
6462 // 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" ) ,
6664] ;
6765
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" ;
6978
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.
7180const VALID_UNRELATED_DOMAIN : & str = "my.1password.com" ;
81+ const VALID_UNRELATED_SUBDOMAIN : & str = "www.amazon.com" ;
7282
7383const LETSENCRYPT_ORG : & str = "letsencrypt.org" ;
7484
@@ -167,43 +177,43 @@ fn real_world_test<E: std::error::Error>(test_case: &TestCase<E>) {
167177// Prefer to staple the OCSP response for the end-entity certificate for
168178// performance and repeatability.
169179real_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 ,
174184 stapled_ocsp: None ,
175185 verification_time: verification_time( ) ,
176186 expected_result: Ok ( ( ) ) ,
177187 other_error: no_error!( ) ,
178188 } ,
179189 // 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 ,
183193 stapled_ocsp: None ,
184194 verification_time: verification_time( ) ,
185195 expected_result: Ok ( ( ) ) ,
186196 other_error: no_error!( ) ,
187197 } ,
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 ,
192202 stapled_ocsp: None ,
193203 verification_time: verification_time( ) ,
194204 expected_result: Ok ( ( ) ) ,
195205 other_error: no_error!( ) ,
196206 } ,
197207 // The certificate isn't valid for an unrelated subdomain.
198208 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 ,
201211 stapled_ocsp: None ,
202212 verification_time: verification_time( ) ,
203213 #[ cfg( not( any( target_vendor = "apple" , windows) ) ) ]
204214 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: VALID_AWS_NAMES . iter ( ) . copied ( ) . map ( String :: from ) . collect ( ) ,
207217 } ) ) ,
208218 #[ cfg( any( target_vendor = "apple" , windows) ) ]
209219 expected_result: Err ( TlsError :: InvalidCertificate ( CertificateError :: NotValidForName ) ) ,
@@ -212,14 +222,14 @@ real_world_test_cases! {
212222 // The certificate chain for the unrelated domain is not valid for
213223 // my.1password.com.
214224 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 ,
217227 stapled_ocsp: None ,
218228 verification_time: verification_time( ) ,
219229 #[ cfg( not( any( target_vendor = "apple" , windows) ) ) ]
220230 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: VALID_AWS_NAMES . iter ( ) . copied ( ) . map ( String :: from ) . collect ( ) ,
223233 } ) ) ,
224234 #[ cfg( any( target_vendor = "apple" , windows) ) ]
225235 expected_result: Err ( TlsError :: InvalidCertificate ( CertificateError :: NotValidForName ) ) ,
0 commit comments