feat: v1.0.1
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,6 +3,7 @@ enc.txt
|
|||||||
enc_key.pem
|
enc_key.pem
|
||||||
sign_key.pem
|
sign_key.pem
|
||||||
test_key.asc
|
test_key.asc
|
||||||
|
test_gpg.asc
|
||||||
.idea/
|
.idea/
|
||||||
# ---> Rust
|
# ---> Rust
|
||||||
# Generated by Cargo
|
# Generated by Cargo
|
||||||
|
|||||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -292,7 +292,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "card-cli"
|
name = "card-cli"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"authenticator",
|
"authenticator",
|
||||||
"base64 0.13.0",
|
"base64 0.13.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "card-cli"
|
name = "card-cli"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -7,16 +7,6 @@ Install:
|
|||||||
cargo install --git https://git.hatter.ink/hatter/card-cli.git
|
cargo install --git https://git.hatter.ink/hatter/card-cli.git
|
||||||
```
|
```
|
||||||
|
|
||||||
TODO:
|
|
||||||
Update openpgp-card versions:
|
|
||||||
```
|
|
||||||
// URL: https://gitlab.com/hkos/openpgp-card
|
|
||||||
openpgp-card = { path = "../openpgp-card", version = "0.2" }
|
|
||||||
openpgp-card-pcsc = { path = "../pcsc", version = "0.2" }
|
|
||||||
openpgp-card-sequoia = { path = "../openpgp-card-sequoia", version = "0.0.8" }
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
# PGP
|
# PGP
|
||||||
|
|
||||||
## decrypt text
|
## decrypt text
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use rust_util::util_clap::{Command, CommandError};
|
|||||||
use sequoia_openpgp::crypto::mpi::PublicKey;
|
use sequoia_openpgp::crypto::mpi::PublicKey;
|
||||||
use sequoia_openpgp::Packet;
|
use sequoia_openpgp::Packet;
|
||||||
use sequoia_openpgp::packet::{Key, Signature};
|
use sequoia_openpgp::packet::{Key, Signature};
|
||||||
use sequoia_openpgp::packet::signature::subpacket::SubpacketTag;
|
use sequoia_openpgp::packet::signature::subpacket::{SubpacketTag, SubpacketValue};
|
||||||
use sequoia_openpgp::parse::{PacketParser, PacketParserResult};
|
use sequoia_openpgp::parse::{PacketParser, PacketParserResult};
|
||||||
use sequoia_openpgp::parse::Parse;
|
use sequoia_openpgp::parse::Parse;
|
||||||
|
|
||||||
@@ -20,12 +20,14 @@ impl Command for CommandImpl {
|
|||||||
SubCommand::with_name(self.name()).about("OpenPGP subcommand")
|
SubCommand::with_name(self.name()).about("OpenPGP subcommand")
|
||||||
.arg(Arg::with_name("in").short("i").long("in").takes_value(true).help("File input, *.pgp or *.asc"))
|
.arg(Arg::with_name("in").short("i").long("in").takes_value(true).help("File input, *.pgp or *.asc"))
|
||||||
.arg(Arg::with_name("detail").long("detail").help("Detail output"))
|
.arg(Arg::with_name("detail").long("detail").help("Detail output"))
|
||||||
|
.arg(Arg::with_name("verbose").long("verbose").help("Verbose output"))
|
||||||
.arg(Arg::with_name("json").long("json").help("JSON output"))
|
.arg(Arg::with_name("json").long("json").help("JSON output"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
|
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
|
||||||
let in_file = sub_arg_matches.value_of("in");
|
let in_file = sub_arg_matches.value_of("in");
|
||||||
let show_detail = sub_arg_matches.is_present("detail");
|
let show_verbose = sub_arg_matches.is_present("verbose");
|
||||||
|
let show_detail = show_verbose || sub_arg_matches.is_present("detail");
|
||||||
|
|
||||||
let in_file = opt_value_result!(in_file, "Input file must assined");
|
let in_file = opt_value_result!(in_file, "Input file must assined");
|
||||||
|
|
||||||
@@ -39,8 +41,30 @@ impl Command for CommandImpl {
|
|||||||
match signature {
|
match signature {
|
||||||
Signature::V4(sig) => {
|
Signature::V4(sig) => {
|
||||||
// information!("-----> {:?}", sig.hashed_area());
|
// information!("-----> {:?}", sig.hashed_area());
|
||||||
|
if show_verbose {
|
||||||
|
sig.hashed_area().iter().for_each(|sub_package| {
|
||||||
|
information!("Hashed area, sub package: {:?}", sub_package);
|
||||||
|
});
|
||||||
|
sig.unhashed_area().iter().for_each(|sub_package| {
|
||||||
|
information!("Unhashed area, sub package: {:?}", sub_package);
|
||||||
|
});
|
||||||
|
}
|
||||||
if let Some(sub_package) = sig.hashed_area().subpacket(SubpacketTag::KeyFlags) {
|
if let Some(sub_package) = sig.hashed_area().subpacket(SubpacketTag::KeyFlags) {
|
||||||
information!("Found sub key flags: {:?}", sub_package);
|
if let SubpacketValue::KeyFlags(key_flags) = sub_package.value() {
|
||||||
|
let mut key_flags_vec = vec![];
|
||||||
|
if key_flags.for_certification() { key_flags_vec.push("Certificate") }
|
||||||
|
if key_flags.for_signing() { key_flags_vec.push("Signing") }
|
||||||
|
if key_flags.for_transport_encryption() { key_flags_vec.push("TransportEncryption") }
|
||||||
|
if key_flags.for_storage_encryption() { key_flags_vec.push("StorageEncryption") }
|
||||||
|
if key_flags.for_authentication() { key_flags_vec.push("Authentication") }
|
||||||
|
if key_flags.is_split_key() { key_flags_vec.push("SplitKey") }
|
||||||
|
if key_flags.is_group_key() { key_flags_vec.push("GroupKey") }
|
||||||
|
debugging!("Found sub key flags: {:?}", sub_package);
|
||||||
|
let authenticated = sub_package.authenticated();
|
||||||
|
information!("Found sub key flags: [{}], {} authenticated", key_flags_vec.join(", "), iff!(authenticated, "is", "not"));
|
||||||
|
} else {
|
||||||
|
information!("Found sub key flags: {:?}", sub_package);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unknown => warning!("Unknown signature: {:?}", unknown),
|
unknown => warning!("Unknown signature: {:?}", unknown),
|
||||||
|
|||||||
Reference in New Issue
Block a user