@@ -26,7 +26,6 @@ use crate::authenticator::Authenticator;
2626use crate :: capella_ca:: CAPELLA_CERT ;
2727use crate :: error;
2828use std:: fmt:: { Debug , Display , Formatter , Result as FmtResult } ;
29- use std:: io:: Cursor ;
3029use std:: net:: SocketAddr ;
3130use std:: sync:: Arc ;
3231use std:: time:: Duration ;
@@ -38,7 +37,6 @@ use tokio_native_tls::native_tls::Identity;
3837#[ cfg( all( feature = "rustls-tls" , not( feature = "native-tls" ) ) ) ]
3938use {
4039 couchbase_core:: insecure_certverfier:: InsecureCertVerifier ,
41- rustls_pemfile:: read_all,
4240 tokio_rustls:: rustls:: crypto:: aws_lc_rs:: default_provider,
4341 tokio_rustls:: rustls:: pki_types:: pem:: { PemObject , SectionKind } ,
4442 tokio_rustls:: rustls:: pki_types:: { CertificateDer , PrivateKeyDer } ,
@@ -568,16 +566,16 @@ impl TlsOptions {
568566 } ;
569567
570568 debug ! ( "Adding Capella root CA to trust store" ) ;
571- let mut cursor = Cursor :: new ( CAPELLA_CERT ) ;
572- let certs = rustls_pemfile:: certs ( & mut cursor)
573- . map ( |item| {
574- item. map_err ( |e| {
575- error:: Error :: other_failure ( format ! ( "failed to add capella cert: {e}" ) )
576- } )
577- } )
578- . collect :: < error:: Result < Vec < CertificateDer > > > ( ) ?;
569+ let certs =
570+ CertificateDer :: from_pem_slice ( CAPELLA_CERT . as_bytes ( ) ) . map_err ( |e| {
571+ error:: Error :: other_failure ( format ! ( "failed to parse capella cert: {e}" ) )
572+ } ) ?;
579573
580- store. add_parsable_certificates ( certs) ;
574+ store. add ( certs) . map_err ( |e| {
575+ error:: Error :: other_failure ( format ! (
576+ "failed to add capella cert to root store: {e}"
577+ ) )
578+ } ) ?;
581579 store
582580 }
583581 } ;
0 commit comments