Struct openssl::ssl::SslContext
[−]
[src]
pub struct SslContext { // some fields omitted }
An SSL context object
Methods
impl SslContext
fn new(method: SslMethod) -> Result<SslContext, SslError>
Creates a new SSL context.
fn set_verify(&mut self, mode: SslVerifyMode, verify: Option<VerifyCallback>)
Configures the certificate verification method for new connections.
fn set_verify_with_data<T>(&mut self, mode: SslVerifyMode, verify: VerifyCallbackData<T>, data: T) where T: Any + 'static
Configures the certificate verification method for new connections also carrying supplied data.
fn set_verify_depth(&mut self, depth: u32)
Sets verification depth
fn set_read_ahead(&self, m: u32)
fn set_tmp_dh(&self, dh: DH) -> Result<(), SslError>
fn set_CA_file<P: AsRef<Path>>(&mut self, file: P) -> Result<(), SslError>
Specifies the file that contains trusted CA certificates.
fn set_certificate_file<P: AsRef<Path>>(&mut self, file: P, file_type: X509FileType) -> Result<(), SslError>
Specifies the file that contains certificate
fn set_certificate_chain_file<P: AsRef<Path>>(&mut self, file: P, file_type: X509FileType) -> Result<(), SslError>
Specifies the file that contains certificate chain
fn set_certificate(&mut self, cert: &X509) -> Result<(), SslError>
Specifies the certificate
fn add_extra_chain_cert(&mut self, cert: &X509) -> Result<(), SslError>
Adds a certificate to the certificate chain presented together with the certificate specified using set_certificate()
fn set_private_key_file<P: AsRef<Path>>(&mut self, file: P, file_type: X509FileType) -> Result<(), SslError>
Specifies the file that contains private key
fn set_private_key(&mut self, key: &PKey) -> Result<(), SslError>
Specifies the private key
fn check_private_key(&mut self) -> Result<(), SslError>
Check consistency of private key and certificate
fn set_cipher_list(&mut self, cipher_list: &str) -> Result<(), SslError>
fn set_ecdh_auto(&mut self, onoff: bool) -> Result<(), SslError>
If onoff
is set to true
, enable ECDHE for key exchange with compatible
clients, and automatically select an appropriate elliptic curve.
This method requires OpenSSL >= 1.2.0 or LibreSSL and the ecdh_auto
feature.
fn set_options(&mut self, option: SslContextOptions) -> SslContextOptions
fn get_options(&mut self) -> SslContextOptions
fn clear_options(&mut self, option: SslContextOptions) -> SslContextOptions
fn set_npn_protocols(&mut self, protocols: &[&[u8]])
Set the protocols to be used during Next Protocol Negotiation (the protocols supported by the application).
This method needs the npn
feature.
fn set_alpn_protocols(&mut self, protocols: &[&[u8]])
Set the protocols to be used during ALPN (application layer protocol negotiation). If this is a server, these are the protocols we report to the client. If this is a client, these are the protocols we try to match with those reported by the server.
Note that ordering of the protocols controls the priority with which they are chosen.
This method needs the alpn
feature.