feat: v0.10.4, add feature with-sequoia-openpgp
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -487,7 +487,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "card-cli"
|
||||
version = "1.10.3"
|
||||
version = "1.10.4"
|
||||
dependencies = [
|
||||
"authenticator 0.3.1",
|
||||
"base64 0.21.7",
|
||||
|
||||
20
Cargo.toml
20
Cargo.toml
@@ -1,9 +1,13 @@
|
||||
[package]
|
||||
name = "card-cli"
|
||||
version = "1.10.3"
|
||||
version = "1.10.4"
|
||||
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[features]
|
||||
default = ["with-sequoia-openpgp"]
|
||||
with-sequoia-openpgp = ["sequoia-openpgp"]
|
||||
|
||||
[dependencies]
|
||||
authenticator = "0.3"
|
||||
clap = "2.0"
|
||||
@@ -20,7 +24,7 @@ u2f = "0.2"
|
||||
openpgp-card = "0.3"
|
||||
openpgp-card-pcsc = "0.3"
|
||||
openpgp-card-sequoia = "0.1"
|
||||
sequoia-openpgp = "1.0"
|
||||
sequoia-openpgp = { version = "1.0", optional = true }
|
||||
chrono = "0.4"
|
||||
simpledateformat = "0.1"
|
||||
ring = "0.17"
|
||||
@@ -38,13 +42,13 @@ tabled = "0.14"
|
||||
env_logger = "0.10"
|
||||
bech32 = "0.9"
|
||||
ecdsa = { version = "0.16", features = ["verifying", "spki", "pem", "der"] }
|
||||
jwt = "0.16.0"
|
||||
jwt = "0.16"
|
||||
reqwest = { version = "0.11", features = ["blocking"] }
|
||||
pinentry = "0.5.0"
|
||||
rpassword = "7.3.1"
|
||||
secrecy = "0.8.0"
|
||||
der-parser = "9.0.0"
|
||||
sshcerts = "0.13.2"
|
||||
pinentry = "0.5"
|
||||
rpassword = "7.3"
|
||||
secrecy = "0.8"
|
||||
der-parser = "9.0"
|
||||
sshcerts = "0.13"
|
||||
#lazy_static = "1.4.0"
|
||||
#ssh-key = "0.4.0"
|
||||
#ctap-hid-fido2 = "2.1.3"
|
||||
|
||||
16
src/main.rs
16
src/main.rs
@@ -21,11 +21,13 @@ mod cmd_u2fsign;
|
||||
mod cmd_rsaencrypt;
|
||||
mod cmd_rsadecrypt;
|
||||
mod cmd_rsaverify;
|
||||
#[cfg(feature = "with-sequoia-openpgp")]
|
||||
mod cmd_pgp;
|
||||
mod cmd_pgpcardadmin;
|
||||
mod cmd_pgpcardlist;
|
||||
mod cmd_pgpcardsign;
|
||||
mod cmd_pgpcarddecrypt;
|
||||
#[cfg(feature = "with-sequoia-openpgp")]
|
||||
mod cmd_pgpcardmake;
|
||||
mod cmd_piv;
|
||||
mod cmd_pivsummary;
|
||||
@@ -86,11 +88,13 @@ fn inner_main() -> CommandError {
|
||||
Box::new(cmd_rsaencrypt::CommandImpl),
|
||||
Box::new(cmd_rsadecrypt::CommandImpl),
|
||||
Box::new(cmd_rsaverify::CommandImpl),
|
||||
#[cfg(feature = "with-sequoia-openpgp")]
|
||||
Box::new(cmd_pgp::CommandImpl),
|
||||
Box::new(cmd_pgpcardadmin::CommandImpl),
|
||||
Box::new(cmd_pgpcardlist::CommandImpl),
|
||||
Box::new(cmd_pgpcardsign::CommandImpl),
|
||||
Box::new(cmd_pgpcarddecrypt::CommandImpl),
|
||||
#[cfg(feature = "with-sequoia-openpgp")]
|
||||
Box::new(cmd_pgpcardmake::CommandImpl),
|
||||
Box::new(cmd_piv::CommandImpl),
|
||||
Box::new(cmd_pivsummary::CommandImpl),
|
||||
@@ -114,10 +118,20 @@ fn inner_main() -> CommandError {
|
||||
Box::new(cmd_signfile::CommandImpl),
|
||||
Box::new(cmd_verifyfile::CommandImpl),
|
||||
];
|
||||
|
||||
let mut features = vec![];
|
||||
#[cfg(feature = "with-sequoia-openpgp")]
|
||||
features.push("with-sequoia-openpgp");
|
||||
let about = format!(
|
||||
"{}, features: [{}]",
|
||||
"Card Cli is a command tool for WebAuthn, OpenPGP, YubiKey ... smart cards",
|
||||
features.join(", "),
|
||||
);
|
||||
|
||||
let mut app = App::new(env!("CARGO_PKG_NAME"))
|
||||
.version(env!("CARGO_PKG_VERSION"))
|
||||
.about(env!("CARGO_PKG_DESCRIPTION"))
|
||||
.long_about("Card Cli is a command tool for WebAuthn, OpenPGP, YubiKey ... smart cards")
|
||||
.long_about(about.as_str())
|
||||
.setting(AppSettings::ColoredHelp);
|
||||
app = DefaultCommandImpl::process_command(app);
|
||||
for command in &commands {
|
||||
|
||||
@@ -3,6 +3,7 @@ use openssl::bn::BigNum;
|
||||
use openssl::rsa::Rsa;
|
||||
use pem::Pem;
|
||||
use rust_util::XResult;
|
||||
#[cfg(feature = "with-sequoia-openpgp")]
|
||||
use sequoia_openpgp::crypto::mpi::PublicKey;
|
||||
use x509_parser::x509::AlgorithmIdentifier;
|
||||
|
||||
@@ -42,6 +43,7 @@ pub fn bytes_to_pem<T>(tag: &str, contents: T) -> String where T: Into<Vec<u8>>
|
||||
pem::encode(&cert_public_key_pem_obj).trim().to_string()
|
||||
}
|
||||
|
||||
#[cfg(feature = "with-sequoia-openpgp")]
|
||||
pub fn sequoia_openpgp_public_key_pem(public_key: &PublicKey) -> Option<(Vec<u8>, String)> {
|
||||
match public_key {
|
||||
PublicKey::RSA { e, n } => {
|
||||
|
||||
Reference in New Issue
Block a user