feat: update swift-secure-enclave-tool.swift

This commit is contained in:
2025-01-18 23:38:17 +08:00
parent cf88722084
commit 7561bea5a3

View File

@@ -172,17 +172,17 @@ if (command == "is_support_secure_enclave") {
exitWith("ok:\(isSupportSecureEnclave())")
}
if (command == "generate_secure_enclave_p256_ecsign_keypair") {
if (command == "generate_p256_ecsign_keypair") {
let requireBio = readArgumentAsBool(index: 2, defaultValue: true)
exitWith(generateSecureEnclaveP256KeyPair(sign: true, requireBio: requireBio))
}
if (command == "generate_secure_enclave_p256_ecdh_keypair") {
if (command == "generate_p256_ecdh_keypair") {
let requireBio = readArgumentAsBool(index: 2, defaultValue: true)
exitWith(generateSecureEnclaveP256KeyPair(sign: false, requireBio: requireBio))
}
if (command == "recover_secure_enclave_p256_ecsign_public_key") {
if (command == "recover_p256_ecsign_public_key") {
if (CommandLine.arguments.count != 3) {
exitWith("err:require two arguments")
}
@@ -191,7 +191,7 @@ if (command == "recover_secure_enclave_p256_ecsign_public_key") {
exitWith(response)
}
if (command == "recover_secure_enclave_p256_ecdh_public_key") {
if (command == "recover_p256_ecdh_public_key") {
if (CommandLine.arguments.count != 3) {
exitWith("err:require two arguments")
}
@@ -200,7 +200,7 @@ if (command == "recover_secure_enclave_p256_ecdh_public_key") {
exitWith(response)
}
if (command == "compute_secure_enclave_p256_ecsign") {
if (command == "compute_p256_ecsign") {
if (CommandLine.arguments.count != 4) {
exitWith("err:require three arguments")
}
@@ -211,7 +211,7 @@ if (command == "compute_secure_enclave_p256_ecsign") {
exitWith(response)
}
if (command == "compute_secure_enclave_p256_ecdh") {
if (command == "compute_p256_ecdh") {
if (CommandLine.arguments.count != 4) {
exitWith("err:require three arguments")
}
@@ -230,13 +230,13 @@ if (command == "help") {
print("swift-secure-enclave-tool <command>")
print("help - print help")
print("version - print version")
print("is_support_secure_enclave - print is support Secure Enclave")
print("generate_secure_enclave_p256_ecsign_keypair [requireBio] - generate Secure Enclave P256 EC sign key pair")
print("generate_secure_enclave_p256_ecdh_keypair [requireBio] - generate Secure Enclave P256 EC DH key pair")
print("recover_secure_enclave_p256_ecsign_public_key <privateKey> - recover Secure Enclave P256 EC sign key pair")
print("recover_secure_enclave_p256_ecdh_public_key <privateKey> - recover Secure Enclave P256 EC DH key pair")
print("compute_secure_enclave_p256_ecsign <privateKey> <content> - compure Secure Enclave P256 EC sign")
print("compute_secure_enclave_p256_ecdh <privateKey> <ephemeraPublicKey> - compure Secure Enclave P256 EC DH")
print("is_support_secure_enclave - is Secure Enclave supported")
print("generate_p256_ecsign_keypair [requireBio] - generate Secure Enclave P256 EC sign key pair")
print("generate_p256_ecdh_keypair [requireBio] - generate Secure Enclave P256 EC DH key pair")
print("recover_p256_ecsign_public_key <privateKey> - recover Secure Enclave P256 EC sign key pair")
print("recover_p256_ecdh_public_key <privateKey> - recover Secure Enclave P256 EC DH key pair")
print("compute_p256_ecsign <privateKey> <content> - compure Secure Enclave P256 EC sign")
print("compute_p256_ecdh <privateKey> <ephemeraPublicKey> - compure Secure Enclave P256 EC DH")
print()
print("options:")
print("> requireBio - true or false (default true)")