Skip to content

Commit a370164

Browse files
committed
windows: import types directly
1 parent 202aee2 commit a370164

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/windows.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
use std::io::Error;
22

33
use pki_types::CertificateDer;
4+
use schannel::cert_context::ValidUses;
5+
use schannel::cert_store::CertStore;
46

57
static PKIX_SERVER_AUTH: &str = "1.3.6.1.5.5.7.3.1";
68

7-
fn usable_for_rustls(uses: schannel::cert_context::ValidUses) -> bool {
9+
fn usable_for_rustls(uses: ValidUses) -> bool {
810
match uses {
9-
schannel::cert_context::ValidUses::All => true,
10-
schannel::cert_context::ValidUses::Oids(strs) => strs
11+
ValidUses::All => true,
12+
ValidUses::Oids(strs) => strs
1113
.iter()
1214
.any(|x| x == PKIX_SERVER_AUTH),
1315
}
@@ -16,7 +18,7 @@ fn usable_for_rustls(uses: schannel::cert_context::ValidUses) -> bool {
1618
pub fn load_native_certs() -> Result<Vec<CertificateDer<'static>>, Error> {
1719
let mut certs = Vec::new();
1820

19-
let current_user_store = schannel::cert_store::CertStore::open_current_user("ROOT")?;
21+
let current_user_store = CertStore::open_current_user("ROOT")?;
2022

2123
for cert in current_user_store.certs() {
2224
if usable_for_rustls(cert.valid_uses().unwrap()) && cert.is_time_valid().unwrap() {

0 commit comments

Comments
 (0)