feat: v1.11.3

This commit is contained in:
2025-03-24 23:25:31 +08:00
parent d04038ccd9
commit 8aeb47c66f
2 changed files with 13 additions and 4 deletions

View File

@@ -30,6 +30,11 @@ impl Command for CommandImpl {
.takes_value(true)
.help("Host name"),
)
.arg(
Arg::with_name("disable-bio")
.long("disable-bio")
.help("Disable bio"),
)
.arg(Arg::with_name("json").long("json").help("JSON output"))
}
@@ -49,9 +54,10 @@ impl Command for CommandImpl {
"key_agreement" | "ecdh" | "dh" => false,
_ => return simple_error!("Invalid type: {}", ty),
};
let require_bio = !sub_arg_matches.is_present("disable-bio");
let (public_key_point, public_key_der, private_key) =
seutil::generate_secure_enclave_p256_keypair(sign)?;
seutil::generate_secure_enclave_p256_keypair(sign, require_bio)?;
let public_key_point_hex = hex::encode(&public_key_point);
let public_key_pem = bytes_to_pem("PUBLIC KEY", &*public_key_der);

View File

@@ -7,11 +7,14 @@ pub fn is_support_se() -> bool {
swift_secure_enclave_tool_rs::is_secure_enclave_supported().unwrap_or(false)
}
pub fn generate_secure_enclave_p256_keypair(sign: bool) -> XResult<(Vec<u8>, Vec<u8>, String)> {
pub fn generate_secure_enclave_p256_keypair(
sign: bool,
require_bio: bool,
) -> XResult<(Vec<u8>, Vec<u8>, String)> {
let key_material = if sign {
swift_secure_enclave_tool_rs::generate_keypair(KeyPurpose::Signing, true)?
swift_secure_enclave_tool_rs::generate_keypair(KeyPurpose::Signing, require_bio)?
} else {
swift_secure_enclave_tool_rs::generate_keypair(KeyPurpose::KeyAgreement, true)?
swift_secure_enclave_tool_rs::generate_keypair(KeyPurpose::KeyAgreement, require_bio)?
};
Ok((
key_material.public_key_point,