@@ -299,46 +299,52 @@ impl RawClient<ElectrumSslStream> {
299299) ) ]
300300mod danger {
301301 use crate :: raw_client:: ServerName ;
302- use rustls:: client :: danger :: ServerCertVerified ;
303- use rustls:: pki_types :: CertificateDer ;
304- use rustls:: pki_types :: UnixTime ;
305- use rustls:: Error ;
302+ use rustls:: pki_types :: { CertificateDer , UnixTime } ;
303+ use rustls:: client :: danger :: { HandshakeSignatureValid , ServerCertVerified } ;
304+ use rustls:: crypto :: CryptoProvider ;
305+ use rustls:: DigitallySignedStruct ;
306306
307307 #[ derive( Debug ) ]
308- pub struct NoCertificateVerification { }
308+ pub struct NoCertificateVerification ( CryptoProvider ) ;
309+
310+ impl NoCertificateVerification {
311+ pub fn new ( provider : CryptoProvider ) -> Self {
312+ Self ( provider)
313+ }
314+ }
309315
310316 impl rustls:: client:: danger:: ServerCertVerifier for NoCertificateVerification {
311317 fn verify_server_cert (
312318 & self ,
313- _end_entity : & CertificateDer ,
314- _intermediates : & [ CertificateDer ] ,
315- _server_name : & ServerName ,
316- _ocsp_response : & [ u8 ] ,
319+ _end_entity : & CertificateDer < ' _ > ,
320+ _intermediates : & [ CertificateDer < ' _ > ] ,
321+ _server_name : & ServerName < ' _ > ,
322+ _ocsp : & [ u8 ] ,
317323 _now : UnixTime ,
318- ) -> Result < ServerCertVerified , Error > {
324+ ) -> Result < ServerCertVerified , rustls :: Error > {
319325 Ok ( ServerCertVerified :: assertion ( ) )
320326 }
321327
322328 fn verify_tls12_signature (
323329 & self ,
324330 _message : & [ u8 ] ,
325331 _cert : & CertificateDer < ' _ > ,
326- _dss : & rustls :: DigitallySignedStruct ,
327- ) -> Result < rustls :: client :: danger :: HandshakeSignatureValid , Error > {
328- Ok ( rustls :: client :: danger :: HandshakeSignatureValid :: assertion ( ) )
332+ _dss : & DigitallySignedStruct ,
333+ ) -> Result < HandshakeSignatureValid , rustls :: Error > {
334+ Ok ( HandshakeSignatureValid :: assertion ( ) )
329335 }
330336
331337 fn verify_tls13_signature (
332338 & self ,
333339 _message : & [ u8 ] ,
334340 _cert : & CertificateDer < ' _ > ,
335- _dss : & rustls :: DigitallySignedStruct ,
336- ) -> Result < rustls :: client :: danger :: HandshakeSignatureValid , Error > {
337- Ok ( rustls :: client :: danger :: HandshakeSignatureValid :: assertion ( ) )
341+ _dss : & DigitallySignedStruct ,
342+ ) -> Result < HandshakeSignatureValid , rustls :: Error > {
343+ Ok ( HandshakeSignatureValid :: assertion ( ) )
338344 }
339345
340346 fn supported_verify_schemes ( & self ) -> Vec < rustls:: SignatureScheme > {
341- vec ! [ ]
347+ self . 0 . signature_verification_algorithms . supported_schemes ( )
342348 }
343349 }
344350}
@@ -420,7 +426,10 @@ impl RawClient<ElectrumSslStream> {
420426 builder
421427 . dangerous ( )
422428 . with_custom_certificate_verifier ( std:: sync:: Arc :: new (
423- danger:: NoCertificateVerification { } ,
429+ #[ cfg( feature = "use-rustls" ) ]
430+ danger:: NoCertificateVerification :: new ( rustls:: crypto:: aws_lc_rs:: default_provider ( ) ) ,
431+ #[ cfg( feature = "use-rustls-ring" ) ]
432+ danger:: NoCertificateVerification :: new ( rustls:: crypto:: aws_lc_rs:: default_provider ( ) ) ,
424433 ) )
425434 . with_no_client_auth ( )
426435 } ;
0 commit comments