Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bindings/bindings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ functions = [
"NSS_SetAlgorithmPolicy",
"PK11_AEADOp",
"PK11_Authenticate",
"PK11_CheckUserPassword",
"PK11_CipherOp",
"PK11_CreateContextBySymKey",
"PK11_Decrypt",
Expand Down Expand Up @@ -196,6 +197,7 @@ functions = [
"PK11_ImportPublicKey",
"PK11_ImportSymKey",
"PK11_ListFixedKeysInSlot",
"PK11_Logout",
"PK11_PubDeriveWithKDF",
"PK11_ReadRawAttribute",
"PK11_ReferenceSlot",
Expand Down
9 changes: 9 additions & 0 deletions src/p11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@ impl Slot {
secstatus_to_res(unsafe { PK11_Authenticate(self.ptr, PRBool::from(true), null_mut()) })
}

pub fn check_user_password(&self, password: &str) -> Res<()> {
Comment thread
Not-Nik marked this conversation as resolved.
let c_password = std::ffi::CString::new(password)?;
secstatus_to_res(unsafe { PK11_CheckUserPassword(self.ptr, c_password.as_ptr()) })
Comment thread
Not-Nik marked this conversation as resolved.
}

pub fn logout(&self) -> Res<()> {
secstatus_to_res(unsafe { PK11_Logout(self.ptr) })
Comment thread
Not-Nik marked this conversation as resolved.
}

/// Find a persistent symmetric key on this slot by nickname.
/// Returns `None` if no key with the given nickname exists.
#[must_use]
Expand Down
Loading