diff --git a/Cargo.toml b/Cargo.toml index 7f64609..d1bf87a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ documentation = "https://docs.rs/r2d2-cryptoki/" serde = ["cryptoki/serde"] [dependencies] -cryptoki = "0.6.0" +cryptoki = "0.7.0" r2d2 = "0.8.10" [dev-dependencies] diff --git a/src/lib.rs b/src/lib.rs index 23131ea..a79817c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,7 @@ pub use cryptoki; pub use r2d2; use cryptoki::{ - context::Pkcs11, + context::{Function, Pkcs11}, error::RvError, session::{Session, SessionState, UserType}, slot::{Limit, Slot}, @@ -136,7 +136,7 @@ impl ManageConnection for SessionManager { }; if let Some(user_type) = maybe_user_info { match session.login(user_type.0, Some(user_type.1)) { - Err(Self::Error::Pkcs11(RvError::UserAlreadyLoggedIn)) => {} + Err(Self::Error::Pkcs11(RvError::UserAlreadyLoggedIn, Function::Login)) => {} res => res?, }; } @@ -147,7 +147,7 @@ impl ManageConnection for SessionManager { let actual_state = session.get_session_info()?.session_state(); let expected_state = &self.session_type; if actual_state != expected_state.as_state() { - Err(Self::Error::Pkcs11(RvError::UserNotLoggedIn)) + Err(Self::Error::Pkcs11(RvError::UserNotLoggedIn, Function::GetSessionInfo)) } else { Ok(()) }