Switch from subtle-encoding to base16ct (#443)
This commit is contained in:
committed by
GitHub
parent
5c4259023f
commit
0a2e798894
Generated
+2
-11
@@ -1003,15 +1003,6 @@ version = "2.4.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "subtle-encoding"
|
|
||||||
version = "0.5.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7dcb1ed7b8330c5eed5441052651dd7a12c75e2ed88f2ec024ae1fa3a5e59945"
|
|
||||||
dependencies = [
|
|
||||||
"zeroize",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.103"
|
version = "1.0.103"
|
||||||
@@ -1270,6 +1261,7 @@ dependencies = [
|
|||||||
name = "yubikey"
|
name = "yubikey"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"base16ct",
|
||||||
"chrono",
|
"chrono",
|
||||||
"cookie-factory",
|
"cookie-factory",
|
||||||
"der-parser",
|
"der-parser",
|
||||||
@@ -1294,7 +1286,6 @@ dependencies = [
|
|||||||
"sha2",
|
"sha2",
|
||||||
"signature",
|
"signature",
|
||||||
"subtle",
|
"subtle",
|
||||||
"subtle-encoding",
|
|
||||||
"uuid",
|
"uuid",
|
||||||
"x509",
|
"x509",
|
||||||
"x509-parser",
|
"x509-parser",
|
||||||
@@ -1305,12 +1296,12 @@ dependencies = [
|
|||||||
name = "yubikey-cli"
|
name = "yubikey-cli"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"base16ct",
|
||||||
"clap",
|
"clap",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"log",
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"sha2",
|
"sha2",
|
||||||
"subtle-encoding",
|
|
||||||
"termcolor",
|
"termcolor",
|
||||||
"x509-parser",
|
"x509-parser",
|
||||||
"yubikey",
|
"yubikey",
|
||||||
|
|||||||
+1
-1
@@ -25,6 +25,7 @@ cookie-factory = "0.3"
|
|||||||
der-parser = "8"
|
der-parser = "8"
|
||||||
des = "0.8"
|
des = "0.8"
|
||||||
elliptic-curve = "0.12"
|
elliptic-curve = "0.12"
|
||||||
|
hex = { package = "base16ct", version = "0.1", features = ["alloc"] }
|
||||||
hmac = "0.12"
|
hmac = "0.12"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
nom = "7"
|
nom = "7"
|
||||||
@@ -41,7 +42,6 @@ secrecy = "0.8"
|
|||||||
sha1 = { version = "0.10", features = ["oid"] }
|
sha1 = { version = "0.10", features = ["oid"] }
|
||||||
sha2 = { version = "0.10", features = ["oid"] }
|
sha2 = { version = "0.10", features = ["oid"] }
|
||||||
subtle = "2"
|
subtle = "2"
|
||||||
subtle-encoding = "0.5"
|
|
||||||
uuid = { version = "1.2", features = ["v4"] }
|
uuid = { version = "1.2", features = ["v4"] }
|
||||||
x509 = "0.2"
|
x509 = "0.2"
|
||||||
x509-parser = "0.14"
|
x509-parser = "0.14"
|
||||||
|
|||||||
+1
-1
@@ -17,10 +17,10 @@ rust-version = "1.56"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4", features = ["derive"] }
|
clap = { version = "4", features = ["derive"] }
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
|
hex = { package = "base16ct", version = "0.1", features = ["alloc"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
once_cell = "1"
|
once_cell = "1"
|
||||||
sha2 = "0.10"
|
sha2 = "0.10"
|
||||||
subtle-encoding = "0.5"
|
|
||||||
termcolor = "1"
|
termcolor = "1"
|
||||||
x509-parser = "0.14"
|
x509-parser = "0.14"
|
||||||
yubikey = { version = "0.6", path = ".." }
|
yubikey = { version = "0.6", path = ".." }
|
||||||
|
|||||||
+1
-2
@@ -8,7 +8,6 @@ use std::{
|
|||||||
str,
|
str,
|
||||||
sync::Mutex,
|
sync::Mutex,
|
||||||
};
|
};
|
||||||
use subtle_encoding::hex;
|
|
||||||
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, StandardStreamLock, WriteColor};
|
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, StandardStreamLock, WriteColor};
|
||||||
use x509_parser::parse_x509_certificate;
|
use x509_parser::parse_x509_certificate;
|
||||||
use yubikey::{certificate::Certificate, piv::*, YubiKey};
|
use yubikey::{certificate::Certificate, piv::*, YubiKey};
|
||||||
@@ -200,7 +199,7 @@ pub fn print_cert_info(
|
|||||||
print_cert_attr(
|
print_cert_attr(
|
||||||
stream,
|
stream,
|
||||||
"Fingerprint",
|
"Fingerprint",
|
||||||
str::from_utf8(hex::encode(fingerprint).as_slice()).unwrap(),
|
&hex::upper::encode_string(&fingerprint),
|
||||||
)?;
|
)?;
|
||||||
print_cert_attr(
|
print_cert_attr(
|
||||||
stream,
|
stream,
|
||||||
|
|||||||
+10
-8
@@ -32,11 +32,7 @@
|
|||||||
|
|
||||||
use crate::{Error, Result, YubiKey};
|
use crate::{Error, Result, YubiKey};
|
||||||
use rand_core::{OsRng, RngCore};
|
use rand_core::{OsRng, RngCore};
|
||||||
use std::{
|
use std::fmt::{self, Debug, Display};
|
||||||
fmt::{self, Debug, Display},
|
|
||||||
str,
|
|
||||||
};
|
|
||||||
use subtle_encoding::hex;
|
|
||||||
|
|
||||||
/// CCCID offset
|
/// CCCID offset
|
||||||
const CCC_ID_OFFS: usize = 9;
|
const CCC_ID_OFFS: usize = 9;
|
||||||
@@ -114,8 +110,14 @@ impl CccId {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for CccId {
|
impl AsRef<[u8]> for CccId {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn as_ref(&self) -> &[u8] {
|
||||||
f.write_str(str::from_utf8(&hex::encode(&self.0[..])).unwrap())
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Display for CccId {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
f.write_str(&hex::upper::encode_string(self.as_ref()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-8
@@ -31,11 +31,7 @@
|
|||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
use crate::{Error, Result, YubiKey};
|
use crate::{Error, Result, YubiKey};
|
||||||
use std::{
|
use std::fmt::{self, Debug, Display};
|
||||||
fmt::{self, Debug, Display},
|
|
||||||
str,
|
|
||||||
};
|
|
||||||
use subtle_encoding::hex;
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
/// FASC-N offset
|
/// FASC-N offset
|
||||||
@@ -130,8 +126,14 @@ impl ChuId {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for ChuId {
|
impl AsRef<[u8]> for ChuId {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn as_ref(&self) -> &[u8] {
|
||||||
f.write_str(str::from_utf8(&hex::encode(&self.0[..])).unwrap())
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Display for ChuId {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
f.write_str(&hex::upper::encode_string(self.as_ref()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user