feat: v1.11.3
This commit is contained in:
@@ -51,7 +51,11 @@ impl Command for CommandImpl {
|
|||||||
let token_string = sign_jwt(&mut yk, slot_id, &pin_opt, header, &payload, &jwt_claims)?;
|
let token_string = sign_jwt(&mut yk, slot_id, &pin_opt, header, &payload, &jwt_claims)?;
|
||||||
|
|
||||||
debugging!("Singed JWT: {}", token_string);
|
debugging!("Singed JWT: {}", token_string);
|
||||||
if json_output { json.insert("token", token_string.clone()); }
|
if json_output {
|
||||||
|
json.insert("token", token_string.clone());
|
||||||
|
} else {
|
||||||
|
success!("Singed JWT: {}", token_string);
|
||||||
|
}
|
||||||
|
|
||||||
if json_output {
|
if json_output {
|
||||||
println!("{}", serde_json::to_string_pretty(&json).unwrap());
|
println!("{}", serde_json::to_string_pretty(&json).unwrap());
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use std::collections::BTreeMap;
|
|||||||
use crate::cmd_signjwt::{build_jwt_parts, merge_header_claims, merge_payload_claims};
|
use crate::cmd_signjwt::{build_jwt_parts, merge_header_claims, merge_payload_claims};
|
||||||
use crate::ecdsautil::parse_ecdsa_to_rs;
|
use crate::ecdsautil::parse_ecdsa_to_rs;
|
||||||
use crate::{hmacutil, util};
|
use crate::{hmacutil, util};
|
||||||
|
use crate::keyutil::{parse_key_uri, KeyUri};
|
||||||
|
|
||||||
const SEPARATOR: &str = ".";
|
const SEPARATOR: &str = ".";
|
||||||
|
|
||||||
@@ -45,14 +46,18 @@ impl Command for CommandImpl {
|
|||||||
"Private key PKCS#8 DER base64 encoded or PEM"
|
"Private key PKCS#8 DER base64 encoded or PEM"
|
||||||
);
|
);
|
||||||
let private_key = hmacutil::try_hmac_decrypt_to_string(private_key)?;
|
let private_key = hmacutil::try_hmac_decrypt_to_string(private_key)?;
|
||||||
|
let KeyUri::SecureEnclaveKey(se_key_uri) = parse_key_uri(&private_key)?;
|
||||||
|
debugging!("Secure enclave key URI: {:?}", se_key_uri);
|
||||||
|
|
||||||
let (header, payload, jwt_claims) = build_jwt_parts(sub_arg_matches)?;
|
let (header, payload, jwt_claims) = build_jwt_parts(sub_arg_matches)?;
|
||||||
|
|
||||||
let token_string = sign_jwt(&private_key, header, &payload, &jwt_claims)?;
|
let token_string = sign_jwt(&se_key_uri.private_key, header, &payload, &jwt_claims)?;
|
||||||
|
|
||||||
debugging!("Singed JWT: {}", token_string);
|
debugging!("Singed JWT: {}", token_string);
|
||||||
if json_output {
|
if json_output {
|
||||||
json.insert("token", token_string.clone());
|
json.insert("token", token_string.clone());
|
||||||
|
} else {
|
||||||
|
success!("Singed JWT: {}", token_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
if json_output {
|
if json_output {
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ impl Command for CommandImpl {
|
|||||||
debugging!("Singed JWT: {}", token_string);
|
debugging!("Singed JWT: {}", token_string);
|
||||||
if json_output {
|
if json_output {
|
||||||
json.insert("token", token_string.clone());
|
json.insert("token", token_string.clone());
|
||||||
|
} else {
|
||||||
|
success!("Singed JWT: {}", token_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
if json_output {
|
if json_output {
|
||||||
|
|||||||
Reference in New Issue
Block a user