pub fn tls_acceptor(
        private_key: &PKey<Private>,
        server_cert: &X509,
        client_auth: ClientAuthentication,
    ) -> Result<SslAcceptor, CreateTlsAcceptorError> {
        let mut builder = SslAcceptor::mozilla_modern_v5(SslMethod::tls_server())
            .expect("Failed to initialize the acceptor.");

        restrict_tls_version_and_cipher_suites_and_sig_algs(&mut builder);

        match client_auth {
            ClientAuthentication::NoAuthentication => {
                prohibit_client_authentication(&mut builder);
            }
            ClientAuthentication::OptionalAuthentication {
                trusted_client_certs,
            } => {
                ensure_root_self_signed_sigs_verified(&mut builder);
                ensure_trusted_client_certs_not_empty(&trusted_client_certs)?;
                allow_but_dont_enforce_client_authentication(&mut builder);
                set_peer_verification_cert_store(trusted_client_certs, &mut builder)?;
                set_maximum_number_of_intermediate_ca_certificates(1, &mut builder);
            }
        }

        set_private_key(private_key, server_cert, &mut builder)?;
        set_certificate(server_cert, &mut builder)?;
        check_private_key(server_cert, &mut builder)?;
        Ok(builder.build())
    }
/// Builds a TLS acceptor to establish TLS connections on the server side.
///
/// For the exact configuration details, see the documentation of the
/// `TlsHandshake` trait in the `ic-crypto-tls-interfaces` crate.
///
/// # Errors
/// * `CreateTlsAcceptorError` if the creation of the acceptor failed
Builds a TLS acceptor to establish TLS connections on the server side.
For the exact configuration details, see the documentation of the
`TlsHandshake` trait in the `ic-crypto-tls-interfaces` crate.
Builds a TLS acceptor to establish TLS connections on the server side . For the exact configuration details see the documentation of the ` TlsHandshake ` trait in the ` ic - crypto - tls - interfaces ` crate .
pub fn tls_acceptor(
        private_key: &PKey<Private>,
        server_cert: &X509,
        client_auth: ClientAuthentication,
    ) -> Result<SslAcceptor, CreateTlsAcceptorError> {
        let mut builder = SslAcceptor::mozilla_modern_v5(SslMethod::tls_server())
            .expect("Failed to initialize the acceptor.");
        restrict_tls_version_and_cipher_suites_and_sig_algs(&mut builder);
        match client_auth {
            ClientAuthentication::NoAuthentication => {
                prohibit_client_authentication(&mut builder);
            }
            ClientAuthentication::OptionalAuthentication {
                trusted_client_certs,
            } => {
                ensure_root_self_signed_sigs_verified(&mut builder);
                ensure_trusted_client_certs_not_empty(&trusted_client_certs)?;
                allow_but_dont_enforce_client_authentication(&mut builder);
                set_peer_verification_cert_store(trusted_client_certs, &mut builder)?;
                set_maximum_number_of_intermediate_ca_certificates(1, &mut builder);
            }
        }
        set_private_key(private_key, server_cert, &mut builder)?;
        set_certificate(server_cert, &mut builder)?;
        check_private_key(server_cert, &mut builder)?;
        Ok(builder.build())
    }
pub fn tls_acceptor ( private_key : & PKey < Private > , server_cert : & X509 , client_auth : ClientAuthentication , ) -> Result < SslAcceptor , CreateTlsAcceptorError > { let mut builder = SslAcceptor :: mozilla_modern_v5 ( SslMethod :: tls_server ( ) ) . expect ( " " ) ; restrict_tls_version_and_cipher_suites_and_sig_algs ( & mut builder ) ; match client_auth { ClientAuthentication :: NoAuthentication => { prohibit_client_authentication ( & mut builder ) ; } ClientAuthentication :: OptionalAuthentication { trusted_client_certs , } => { ensure_root_self_signed_sigs_verified ( & mut builder ) ; ensure_trusted_client_certs_not_empty ( & trusted_client_certs ) ? ; allow_but_dont_enforce_client_authentication ( & mut builder ) ; set_peer_verification_cert_store ( trusted_client_certs , & mut builder ) ? ; set_maximum_number_of_intermediate_ca_certificates ( 1 , & mut builder ) ; } } set_private_key ( private_key , server_cert , & mut builder ) ? ; set_certificate ( server_cert , & mut builder ) ? ; check_private_key ( server_cert , & mut builder ) ? ; Ok ( builder . build ( ) ) }
Builds a TLS acceptor to establish TLS connections on the server side.
Builds a TLS acceptor to establish TLS connections on the server side .
private_key
&PKey<Private>
server_cert
&X509
client_auth
ClientAuthentication
private_key
&PKey<Private>
server_cert
&X509
client_auth
ClientAuthentication
errors
`CreateTlsAcceptorError` if the creation of the acceptor failed
` CreateTlsAcceptorError ` if the creation of the acceptor failed