@@ -209,36 +209,44 @@ async fn test_non_existing_partition() {
209209#[ tokio:: test]
210210#[ cfg( feature = "transport-tls" ) ]
211211async fn test_tls ( ) {
212+ use rustls_pki_types:: {
213+ PrivateKeyDer ,
214+ pem:: { PemObject , SectionKind } ,
215+ } ;
216+
212217 maybe_start_logging ( ) ;
213218
214219 let mut root_store = rustls:: RootCertStore :: empty ( ) ;
215220
216221 let file = std:: fs:: File :: open ( "/tmp/cluster-ca.crt" ) . unwrap ( ) ;
217222 let mut reader = std:: io:: BufReader :: new ( file) ;
218- match rustls_pemfile:: read_one ( & mut reader) . unwrap ( ) . unwrap ( ) {
219- rustls_pemfile:: Item :: X509Certificate ( key) => {
220- root_store. add ( key) . unwrap ( ) ;
223+ match rustls_pki_types:: pem:: from_buf ( & mut reader)
224+ . unwrap ( )
225+ . unwrap ( )
226+ {
227+ ( SectionKind :: Certificate , data) => {
228+ root_store. add ( data. into ( ) ) . unwrap ( ) ;
221229 }
222230 _ => unreachable ! ( ) ,
223231 }
224232
225233 let file = std:: fs:: File :: open ( "/tmp/ca.crt" ) . unwrap ( ) ;
226234 let mut reader = std:: io:: BufReader :: new ( file) ;
227- let producer_root = match rustls_pemfile:: read_one ( & mut reader) . unwrap ( ) . unwrap ( ) {
228- rustls_pemfile:: Item :: X509Certificate ( key) => key,
235+ let producer_root = match rustls_pki_types:: pem:: from_buf ( & mut reader)
236+ . unwrap ( )
237+ . unwrap ( )
238+ {
239+ ( SectionKind :: Certificate , data) => data,
229240 _ => unreachable ! ( ) ,
230241 } ;
231242
232243 let file = std:: fs:: File :: open ( "/tmp/ca.key" ) . unwrap ( ) ;
233244 let mut reader = std:: io:: BufReader :: new ( file) ;
234- let private_key = match rustls_pemfile:: read_one ( & mut reader) . unwrap ( ) . unwrap ( ) {
235- rustls_pemfile:: Item :: Pkcs8Key ( key) => rustls:: pki_types:: PrivateKeyDer :: Pkcs8 ( key) ,
236- _ => unreachable ! ( ) ,
237- } ;
245+ let private_key = PrivateKeyDer :: from_pem_reader ( & mut reader) . unwrap ( ) ;
238246
239247 let config = rustls:: ClientConfig :: builder ( )
240248 . with_root_certificates ( root_store)
241- . with_client_auth_cert ( vec ! [ producer_root] , private_key)
249+ . with_client_auth_cert ( vec ! [ producer_root. into ( ) ] , private_key)
242250 . unwrap ( ) ;
243251
244252 let test_cfg = maybe_skip_kafka_integration ! ( ) ;
0 commit comments