diff --git a/.gitignore b/.gitignore index 9b7c237d..c65aed2f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,10 @@ *DS_Store *.patch *NVChip + +#IDEs .vscode +.idea + +#build artifacts +cryptoki-sys/pkcs11-precompile.h diff --git a/Cargo.lock b/Cargo.lock index e02d7e0e..d1ae0931 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -315,9 +315,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "secrecy" -version = "0.8.0" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +checksum = "e891af845473308773346dc847b2c23ee78fe442e0472ac50e22a18a93d3ae5a" dependencies = [ "serde", "zeroize", diff --git a/cryptoki/Cargo.toml b/cryptoki/Cargo.toml index 4f2ee630..1da0b6d5 100644 --- a/cryptoki/Cargo.toml +++ b/cryptoki/Cargo.toml @@ -18,7 +18,7 @@ libloading = "0.8.6" log = "0.4.14" cryptoki-sys = { path = "../cryptoki-sys", version = "0.4.0" } paste = "1.0.6" -secrecy = "0.8.0" +secrecy = "0.10.3" [dev-dependencies] num-traits = "0.2.14" diff --git a/cryptoki/src/session/session_management.rs b/cryptoki/src/session/session_management.rs index 4c7a5b67..c5f22b03 100644 --- a/cryptoki/src/session/session_management.rs +++ b/cryptoki/src/session/session_management.rs @@ -62,8 +62,8 @@ impl Session { } /// Logs a session in using a slice of raw bytes as a PIN. Some dongle drivers allow - /// non UTF-8 characters in the PIN and as a result, we aren't guaranteed that we can - /// pass in a UTF-8 string to login. Therefore, it's useful to be able to pass in raw bytes + /// non UTF-8 characters in the PIN and, as a result, we aren't guaranteed that we can + /// pass in a UTF-8 string to `login`. Therefore, it's useful to be able to pass in raw bytes /// rather than convert a UTF-8 string to bytes. /// /// # Arguments diff --git a/cryptoki/src/types.rs b/cryptoki/src/types.rs index 19249450..995a8348 100644 --- a/cryptoki/src/types.rs +++ b/cryptoki/src/types.rs @@ -4,8 +4,7 @@ use crate::error::{Error, Result}; use cryptoki_sys::*; -use secrecy::SecretString; -use secrecy::SecretVec; +use secrecy::{SecretBox, SecretString}; use std::convert::TryFrom; use std::convert::TryInto; use std::fmt::Formatter; @@ -29,7 +28,7 @@ impl Date { /// /// # Errors /// - /// If the lengths are invalid a `Error::InvalidValue` will be returned + /// If the lengths are invalid, an `Error::InvalidValue` will be returned pub fn new_from_str_slice(year: &str, month: &str, day: &str) -> Result { if year.len() != 4 || month.len() != 2 || day.len() != 2 { Err(Error::InvalidValue) @@ -222,22 +221,22 @@ impl From for Version { /// A UTC datetime returned by a token's clock if present. #[derive(Copy, Clone, Debug)] pub struct UtcTime { - /// **[Conformance](crate#conformance-notes):** + /// **[Conformance](crate#conformance-notes): ** /// Guaranteed to be in range 0..=9999 pub year: u16, - /// **[Conformance](crate#conformance-notes):** + /// **[Conformance](crate#conformance-notes): ** /// Guaranteed to be in range 0..=99 pub month: u8, - /// **[Conformance](crate#conformance-notes):** + /// **[Conformance](crate#conformance-notes): ** /// Guaranteed to be in range 0..=99 pub day: u8, - /// **[Conformance](crate#conformance-notes):** + /// **[Conformance](crate#conformance-notes): ** /// Guaranteed to be in range 0..=99 pub hour: u8, - /// **[Conformance](crate#conformance-notes):** + /// **[Conformance](crate#conformance-notes): ** /// Guaranteed to be in range 0..=99 pub minute: u8, - /// **[Conformance](crate#conformance-notes):** + /// **[Conformance](crate#conformance-notes): ** /// Guaranteed to be in range 0..=99 pub second: u8, } @@ -248,7 +247,7 @@ impl UtcTime { /// PKCS#11 and ISO are unrelated standards, and this function is provided /// only for convenience. ISO format is more widely recognized and parsable /// by various date/time utilities, while PKCS#11's internal representation - /// of this type is is not used elsewhere. + /// of this type is not used elsewhere. /// Other than formatting, this crate does not guarantee or enforce any part /// of the ISO standard. pub fn as_iso8601_string(&self) -> String { @@ -281,7 +280,7 @@ pub type AuthPin = SecretString; /// Secret wrapper for a raw non UTF-8 Pin /// /// Enable the `serde` feature to add support for Deserialize -pub type RawAuthPin = SecretVec; +pub type RawAuthPin = SecretBox>; #[cfg(test)] mod test {