@@ -4,8 +4,9 @@ use std::io::Cursor;
44
55use rustls_pki_types:: pem:: PemObject ;
66use rustls_pki_types:: {
7- pem, CertificateDer , CertificateRevocationListDer , CertificateSigningRequestDer , PrivateKeyDer ,
8- PrivatePkcs1KeyDer , PrivatePkcs8KeyDer , PrivateSec1KeyDer , SubjectPublicKeyInfoDer ,
7+ pem, CertificateDer , CertificateRevocationListDer , CertificateSigningRequestDer ,
8+ EchConfigListBytes , PrivateKeyDer , PrivatePkcs1KeyDer , PrivatePkcs8KeyDer , PrivateSec1KeyDer ,
9+ SubjectPublicKeyInfoDer ,
910} ;
1011
1112#[ test]
@@ -180,6 +181,20 @@ fn crls() {
180181 ) ;
181182}
182183
184+ #[ test]
185+ fn ech_config ( ) {
186+ let data = include_bytes ! ( "data/zen.pem" ) ;
187+
188+ EchConfigListBytes :: from_pem_slice ( data) . unwrap ( ) ;
189+ EchConfigListBytes :: from_pem_reader ( & mut Cursor :: new ( & data[ ..] ) ) . unwrap ( ) ;
190+ EchConfigListBytes :: from_pem_file ( "tests/data/zen.pem" ) . unwrap ( ) ;
191+
192+ assert ! ( matches!(
193+ EchConfigListBytes :: from_pem_file( "tests/data/certificate.chain.pem" ) . unwrap_err( ) ,
194+ pem:: Error :: NoItemsFound
195+ ) ) ;
196+ }
197+
183198#[ test]
184199fn certificates_with_binary ( ) {
185200 let data = include_bytes ! ( "data/gunk.pem" ) ;
@@ -212,7 +227,7 @@ fn parse_in_order() {
212227 let items = <( pem:: SectionKind , Vec < u8 > ) as PemObject >:: pem_slice_iter ( data)
213228 . collect :: < Result < Vec < _ > , _ > > ( )
214229 . unwrap ( ) ;
215- assert_eq ! ( items. len( ) , 11 ) ;
230+ assert_eq ! ( items. len( ) , 12 ) ;
216231 assert ! ( matches!( items[ 0 ] , ( pem:: SectionKind :: Certificate , _) ) ) ;
217232 assert ! ( matches!( items[ 1 ] , ( pem:: SectionKind :: Certificate , _) ) ) ;
218233 assert ! ( matches!( items[ 2 ] , ( pem:: SectionKind :: Certificate , _) ) ) ;
@@ -224,6 +239,7 @@ fn parse_in_order() {
224239 assert ! ( matches!( items[ 8 ] , ( pem:: SectionKind :: PrivateKey , _) ) ) ;
225240 assert ! ( matches!( items[ 9 ] , ( pem:: SectionKind :: Crl , _) ) ) ;
226241 assert ! ( matches!( items[ 10 ] , ( pem:: SectionKind :: Csr , _) ) ) ;
242+ assert ! ( matches!( items[ 11 ] , ( pem:: SectionKind :: EchConfigList , _) ) ) ;
227243}
228244
229245#[ test]
0 commit comments