feat(tools):完成计算Power插件中EQUAL内容的功能。

This commit is contained in:
徐涛 2024-04-02 13:25:45 +08:00
parent ac0856bdb7
commit 26dd427aea
2 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,6 @@
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use generate_key::{generate_key_file, GenerateKeyOptions}; use generate_key::{generate_key_file, GenerateKeyOptions};
use power_equal::PowerEqualResultOption; use power_equal::{calculate_equal_result, PowerEqualResultOption};
mod generate_key; mod generate_key;
mod power_equal; mod power_equal;
@ -28,8 +28,6 @@ fn main() {
let args = Cli::parse(); let args = Cli::parse();
match args.command { match args.command {
Commands::Generate(options) => generate_key_file(options), Commands::Generate(options) => generate_key_file(options),
Commands::CalcEqual(_options) => { Commands::CalcEqual(options) => calculate_equal_result(options),
println!("Calculating the equal result for power plugin");
}
} }
} }

View File

@ -7,3 +7,10 @@ pub struct PowerEqualResultOption {
#[arg(help = "Certificate file")] #[arg(help = "Certificate file")]
key_file: PathBuf, key_file: PathBuf,
} }
pub fn calculate_equal_result(options: PowerEqualResultOption) {
let cert = cert_lib::load_certificate(options.key_file).expect("load certificate failed");
let result =
cert_lib::calculate_power_euqal_result(cert).expect("calculate equal result failed");
println!("{}", result);
}