feat: updates
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
use crate::cmd_sign_jwt::digest_by_jwt_algorithm;
|
use crate::cmd_sign_jwt_piv::digest_by_jwt_algorithm;
|
||||||
use crate::cmd_sign_jwt_soft::{convert_jwt_algorithm_to_ecdsa_algorithm, parse_ecdsa_private_key};
|
use crate::cmd_sign_jwt_soft::{convert_jwt_algorithm_to_ecdsa_algorithm, parse_ecdsa_private_key};
|
||||||
use crate::ecdsautil::EcdsaSignType;
|
use crate::ecdsautil::EcdsaSignType;
|
||||||
use crate::keyutil::{parse_key_uri, KeyAlgorithmId, KeyUri, KeyUsage, YubikeyPivKey};
|
use crate::keyutil::{parse_key_uri, KeyAlgorithmId, KeyUri, KeyUsage, YubikeyPivKey};
|
||||||
|
|||||||
@@ -70,7 +70,8 @@ pub fn fill_sign_jwt_app_args<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
|
|||||||
.arg(Arg::with_name("claims").short("C").long("claims").takes_value(true).multiple(true).help("Claims, key:value"))
|
.arg(Arg::with_name("claims").short("C").long("claims").takes_value(true).multiple(true).help("Claims, key:value"))
|
||||||
.arg(Arg::with_name("payload").short("P").long("payload").takes_value(true).help("Claims in JSON"))
|
.arg(Arg::with_name("payload").short("P").long("payload").takes_value(true).help("Claims in JSON"))
|
||||||
.arg(Arg::with_name("jti").long("jti").help("Claims jti"))
|
.arg(Arg::with_name("jti").long("jti").help("Claims jti"))
|
||||||
.arg(Arg::with_name("validity").long("validity").takes_value(true).help("Claims validity period e.g. 10m means 10 minutes (s - second, m - minute, h - hour, d - day)"))
|
.arg(Arg::with_name("validity").long("validity").takes_value(true)
|
||||||
|
.help("Claims validity period e.g. 10m means 10 minutes (s - second, m - minute, h - hour, d - day)"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sign_jwt(
|
fn sign_jwt(
|
||||||
@@ -5,10 +5,10 @@ use rust_util::util_clap::{Command, CommandError};
|
|||||||
use rust_util::XResult;
|
use rust_util::XResult;
|
||||||
use serde_json::{Map, Value};
|
use serde_json::{Map, Value};
|
||||||
|
|
||||||
use crate::cmd_sign_jwt::{build_jwt_parts, merge_header_claims, merge_payload_claims, print_jwt_token};
|
use crate::cmd_sign_jwt_piv::{build_jwt_parts, merge_header_claims, merge_payload_claims, print_jwt_token};
|
||||||
use crate::ecdsautil::parse_ecdsa_to_rs;
|
use crate::ecdsautil::parse_ecdsa_to_rs;
|
||||||
use crate::keyutil::parse_key_uri;
|
use crate::keyutil::parse_key_uri;
|
||||||
use crate::{cmd_hmac_decrypt, cmd_sign_jwt, cmdutil, util};
|
use crate::{cmd_hmac_decrypt, cmd_sign_jwt_piv, cmdutil, util};
|
||||||
use crate::util::base64_decode;
|
use crate::util::base64_decode;
|
||||||
|
|
||||||
const SEPARATOR: &str = ".";
|
const SEPARATOR: &str = ".";
|
||||||
@@ -24,7 +24,7 @@ impl Command for CommandImpl {
|
|||||||
let app = SubCommand::with_name(self.name()).about("Sign JWT subcommand")
|
let app = SubCommand::with_name(self.name()).about("Sign JWT subcommand")
|
||||||
.arg(cmdutil::build_key_uri_arg())
|
.arg(cmdutil::build_key_uri_arg())
|
||||||
.arg(cmdutil::build_json_arg());
|
.arg(cmdutil::build_json_arg());
|
||||||
cmd_sign_jwt::fill_sign_jwt_app_args(app)
|
cmd_sign_jwt_piv::fill_sign_jwt_app_args(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
|
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ use rust_util::util_clap::{Command, CommandError};
|
|||||||
use rust_util::XResult;
|
use rust_util::XResult;
|
||||||
use serde_json::{Map, Value};
|
use serde_json::{Map, Value};
|
||||||
|
|
||||||
use crate::cmd_sign_jwt::{build_jwt_parts, digest_by_jwt_algorithm, merge_header_claims, merge_payload_claims, print_jwt_token};
|
use crate::cmd_sign_jwt_piv::{build_jwt_parts, digest_by_jwt_algorithm, merge_header_claims, merge_payload_claims, print_jwt_token};
|
||||||
use crate::keychain::{KeychainKey, KeychainKeyValue};
|
use crate::keychain::{KeychainKey, KeychainKeyValue};
|
||||||
use crate::{cmd_hmac_decrypt, cmd_sign_jwt, cmdutil, ecdsautil, keychain, util};
|
use crate::{cmd_hmac_decrypt, cmd_sign_jwt_piv, cmdutil, ecdsautil, keychain, util};
|
||||||
use crate::ecdsautil::{EcdsaAlgorithm, EcdsaSignType};
|
use crate::ecdsautil::{EcdsaAlgorithm, EcdsaSignType};
|
||||||
|
|
||||||
const SEPARATOR: &str = ".";
|
const SEPARATOR: &str = ".";
|
||||||
@@ -22,7 +22,7 @@ impl Command for CommandImpl {
|
|||||||
let app = SubCommand::with_name(self.name()).about("Sign JWT subcommand")
|
let app = SubCommand::with_name(self.name()).about("Sign JWT subcommand")
|
||||||
.arg(Arg::with_name("private-key").short("k").long("private-key").takes_value(true).help("Private key PKCS#8"))
|
.arg(Arg::with_name("private-key").short("k").long("private-key").takes_value(true).help("Private key PKCS#8"))
|
||||||
.arg(cmdutil::build_json_arg());
|
.arg(cmdutil::build_json_arg());
|
||||||
cmd_sign_jwt::fill_sign_jwt_app_args(app)
|
cmd_sign_jwt_piv::fill_sign_jwt_app_args(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
|
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ mod cmd_se_ecdh;
|
|||||||
mod cmd_se_ecsign;
|
mod cmd_se_ecsign;
|
||||||
mod cmd_se_generate;
|
mod cmd_se_generate;
|
||||||
mod cmd_se_recover;
|
mod cmd_se_recover;
|
||||||
mod cmd_sign_jwt;
|
mod cmd_sign_jwt_piv;
|
||||||
mod cmd_sign_jwt_se;
|
mod cmd_sign_jwt_se;
|
||||||
mod cmd_sign_jwt_soft;
|
mod cmd_sign_jwt_soft;
|
||||||
mod cmd_ssh_agent;
|
mod cmd_ssh_agent;
|
||||||
@@ -142,7 +142,7 @@ fn inner_main() -> CommandError {
|
|||||||
Box::new(cmd_ssh_pub_key::CommandImpl),
|
Box::new(cmd_ssh_pub_key::CommandImpl),
|
||||||
Box::new(cmd_ssh_parse::CommandImpl),
|
Box::new(cmd_ssh_parse::CommandImpl),
|
||||||
Box::new(cmd_pgp_age_address::CommandImpl),
|
Box::new(cmd_pgp_age_address::CommandImpl),
|
||||||
Box::new(cmd_sign_jwt::CommandImpl),
|
Box::new(cmd_sign_jwt_piv::CommandImpl),
|
||||||
Box::new(cmd_sign_jwt_soft::CommandImpl),
|
Box::new(cmd_sign_jwt_soft::CommandImpl),
|
||||||
Box::new(cmd_sign_jwt_se::CommandImpl),
|
Box::new(cmd_sign_jwt_se::CommandImpl),
|
||||||
Box::new(cmd_file_sign::CommandImpl),
|
Box::new(cmd_file_sign::CommandImpl),
|
||||||
|
|||||||
Reference in New Issue
Block a user