Derived for Windows and macOS, hand-rolled for Linux due to a missing downstream Debug dependency. I whipped up a little test script and ran it across Linux, macOS, and Windows and to my eyes it doesn't appear to be leaking anything sensitive.
extern crate native_tls;
use native_tls::{Identity, TlsConnector};
use std::fs::File;
use std::io::Read;
use std::path::Path;
fn main() {
let pkcs12 = File::open(
Path::new(env!("CARGO_MANIFEST_DIR"))
.join("test")
.join("identity.p12"),
)
.map(|mut f| {
let mut pkcs12 = vec![];
f.read_to_end(&mut pkcs12).unwrap();
pkcs12
})
.unwrap();
let tls = TlsConnector::builder()
.identity(Identity::from_pkcs12(&pkcs12, "mypass").unwrap())
.build()
.unwrap();
println!("{:#?}", tls);
}
Closes #99
Derived for Windows and macOS, hand-rolled for Linux due to a missing downstream Debug dependency. I whipped up a little test script and ran it across Linux, macOS, and Windows and to my eyes it doesn't appear to be leaking anything sensitive.
Linux
```rust TlsConnector( TlsConnector { use_sni: true, accept_invalid_hostnames: false, accept_invalid_certs: false, }, ) ```MacOS
```rust TlsConnector( TlsConnector { identity: Some( Identity { identity: SecIdentity { certificate: SecCertificate { subject: "foobar.com", }, private_key: SecKey, }, chain: [ SecCertificate { subject: "Internet Widgits Pty Ltd", }, ], }, ), min_protocol: Some( Tlsv10, ), max_protocol: None, roots: [], use_sni: true, danger_accept_invalid_hostnames: false, danger_accept_invalid_certs: false, disable_built_in_roots: false, }, ) ```Windows
```rust TlsConnector( TlsConnector { cert: Some( CertContext( 0x000002205c2638c0, ), ), roots: CertStore, min_protocol: Some( Tlsv10, ), max_protocol: None, use_sni: true, accept_invalid_hostnames: false, accept_invalid_certs: false, disable_built_in_roots: false, }, ) ```