From 460f43dd2bf6a37fa06ce57288f0937c65bde4f9 Mon Sep 17 00:00:00 2001 From: Berend Sliedrecht Date: Wed, 24 Jul 2024 11:05:26 +0200 Subject: [PATCH] android biometrics required for key sign Signed-off-by: Berend Sliedrecht --- .github/workflows/android_test.sh | 2 +- examples/android/Cargo.lock | 441 +----------------------------- examples/ios/Cargo.toml | 2 +- examples/mobile_tests/src/lib.rs | 4 +- src/android.rs | 47 +++- src/jni_tokens.rs | 18 ++ 6 files changed, 78 insertions(+), 436 deletions(-) diff --git a/.github/workflows/android_test.sh b/.github/workflows/android_test.sh index 25d2dc1..dd841a3 100755 --- a/.github/workflows/android_test.sh +++ b/.github/workflows/android_test.sh @@ -19,7 +19,7 @@ else fi if [ -n "$HAS_ERROR" ]; then - cat $LOG + echo $LOG echo "::error:: Rust panicked! Tests failed. Logs will be uploaded" exit 1 else diff --git a/examples/android/Cargo.lock b/examples/android/Cargo.lock index 78680da..5ab593e 100644 --- a/examples/android/Cargo.lock +++ b/examples/android/Cargo.lock @@ -2,41 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "aead" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" -dependencies = [ - "crypto-common", - "generic-array", -] - -[[package]] -name = "aes" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - -[[package]] -name = "aes-gcm" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" -dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", - "subtle", -] - [[package]] name = "aho-corasick" version = "1.1.2" @@ -66,7 +31,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9880c221189377adad673ed5030e06d38578d86fa6bcf79dc7b135e64ac545c" dependencies = [ "android-properties", - "bitflags 2.4.2", + "bitflags 2.6.0", "cc", "cesu8", "jni", @@ -120,43 +85,6 @@ dependencies = [ "x509-parser", ] -[[package]] -name = "askar-crypto" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39746932b19e345196a089e61a0f0175fc4d673db4b624424d8babf505e48a3d" -dependencies = [ - "aead", - "aes", - "aes-gcm", - "base64", - "blake2", - "block-modes", - "bls12_381", - "cbc", - "chacha20", - "chacha20poly1305", - "cipher", - "crypto_box", - "curve25519-dalek", - "digest", - "ed25519-dalek", - "elliptic-curve", - "group", - "hkdf", - "hmac", - "k256", - "p256", - "p384", - "rand", - "serde", - "serde-json-core", - "sha2", - "subtle", - "x25519-dalek", - "zeroize", -] - [[package]] name = "asn1-rs" version = "0.6.1" @@ -208,12 +136,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64ct" version = "1.6.0" @@ -228,18 +150,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" - -[[package]] -name = "blake2" -version = "0.10.6" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest", -] +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -250,49 +163,12 @@ dependencies = [ "generic-array", ] -[[package]] -name = "block-modes" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e2211b0817f061502a8dd9f11a37e879e79763e3c698d2418cf824d8cb2f21e" - -[[package]] -name = "block-padding" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bls12_381" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7bc6d6292be3a19e6379786dac800f551e5865a5bb51ebbe3064ab80433f403" -dependencies = [ - "ff", - "group", - "rand_core", - "subtle", - "zeroize", -] - [[package]] name = "bytes" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" -[[package]] -name = "cbc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" -dependencies = [ - "cipher", -] - [[package]] name = "cc" version = "1.0.86" @@ -314,41 +190,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chacha20" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - -[[package]] -name = "chacha20poly1305" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" -dependencies = [ - "aead", - "chacha20", - "cipher", - "poly1305", - "zeroize", -] - -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", - "zeroize", -] - [[package]] name = "combine" version = "4.6.6" @@ -409,76 +250,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", - "rand_core", "typenum", ] -[[package]] -name = "crypto_box" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16182b4f39a82ec8a6851155cc4c0cda3065bb1db33651726a29e1951de0f009" -dependencies = [ - "aead", - "crypto_secretbox", - "curve25519-dalek", - "salsa20", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto_secretbox" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d6cf87adf719ddf43a805e92c6870a531aedda35ff640442cbaf8674e141e1" -dependencies = [ - "aead", - "cipher", - "generic-array", - "poly1305", - "salsa20", - "subtle", - "zeroize", -] - -[[package]] -name = "ctr" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" -dependencies = [ - "cipher", -] - -[[package]] -name = "curve25519-dalek" -version = "4.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" -dependencies = [ - "cfg-if", - "cpufeatures", - "curve25519-dalek-derive", - "digest", - "fiat-crypto", - "platforms", - "rustc_version", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.50", -] - [[package]] name = "data-encoding" version = "2.5.0" @@ -556,28 +330,6 @@ dependencies = [ "spki", ] -[[package]] -name = "ed25519" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" -dependencies = [ - "signature", -] - -[[package]] -name = "ed25519-dalek" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" -dependencies = [ - "curve25519-dalek", - "ed25519", - "sha2", - "subtle", - "zeroize", -] - [[package]] name = "elliptic-curve" version = "0.13.8" @@ -590,7 +342,6 @@ dependencies = [ "ff", "generic-array", "group", - "hkdf", "pem-rfc7468", "pkcs8", "rand_core", @@ -625,12 +376,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "fiat-crypto" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" - [[package]] name = "generic-array" version = "0.14.7" @@ -653,16 +398,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "ghash" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" -dependencies = [ - "opaque-debug", - "polyval", -] - [[package]] name = "glob" version = "0.3.1" @@ -686,15 +421,6 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" -[[package]] -name = "hkdf" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" -dependencies = [ - "hmac", -] - [[package]] name = "hmac" version = "0.12.1" @@ -714,16 +440,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "inout" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" -dependencies = [ - "block-padding", - "generic-array", -] - [[package]] name = "itoa" version = "1.0.10" @@ -764,18 +480,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" -[[package]] -name = "k256" -version = "0.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" -dependencies = [ - "cfg-if", - "ecdsa", - "elliptic-curve", - "sha2", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -821,7 +525,6 @@ name = "mobile_tests" version = "0.1.0" dependencies = [ "animo-secure-env", - "askar-crypto", "p256", "uuid", ] @@ -876,11 +579,10 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ - "autocfg", "num-integer", "num-traits", ] @@ -966,12 +668,6 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - [[package]] name = "p256" version = "0.13.2" @@ -984,18 +680,6 @@ dependencies = [ "sha2", ] -[[package]] -name = "p384" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" -dependencies = [ - "ecdsa", - "elliptic-curve", - "primeorder", - "sha2", -] - [[package]] name = "paste" version = "1.0.15" @@ -1021,35 +705,6 @@ dependencies = [ "spki", ] -[[package]] -name = "platforms" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" - -[[package]] -name = "poly1305" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" -dependencies = [ - "cpufeatures", - "opaque-debug", - "universal-hash", -] - -[[package]] -name = "polyval" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug", - "universal-hash", -] - [[package]] name = "powerfmt" version = "0.2.0" @@ -1183,15 +838,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - [[package]] name = "rusticata-macros" version = "4.1.0" @@ -1201,21 +847,6 @@ dependencies = [ "nom", ] -[[package]] -name = "ryu" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" - -[[package]] -name = "salsa20" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" -dependencies = [ - "cipher", -] - [[package]] name = "same-file" version = "1.0.6" @@ -1241,33 +872,28 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.2" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "core-foundation", "core-foundation-sys", "libc", + "num-bigint", "security-framework-sys", ] [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" dependencies = [ "core-foundation-sys", "libc", ] -[[package]] -name = "semver" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" - [[package]] name = "serde" version = "1.0.197" @@ -1277,16 +903,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-json-core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c9e1ab533c0bc414c34920ec7e5f097101d126ed5eac1a1aac711222e0bbb33" -dependencies = [ - "ryu", - "serde", -] - [[package]] name = "serde_derive" version = "1.0.197" @@ -1459,16 +1075,6 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "universal-hash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" -dependencies = [ - "crypto-common", - "subtle", -] - [[package]] name = "uuid" version = "1.7.0" @@ -1607,17 +1213,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "x25519-dalek" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" -dependencies = [ - "curve25519-dalek", - "rand_core", - "zeroize", -] - [[package]] name = "x509-parser" version = "0.16.0" @@ -1640,17 +1235,3 @@ name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.50", -] diff --git a/examples/ios/Cargo.toml b/examples/ios/Cargo.toml index 08fca2a..25c906e 100644 --- a/examples/ios/Cargo.toml +++ b/examples/ios/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["staticlib"] build_targets = ["aarch64-apple-ios-sim", "aarch64-apple-ios", "x86_64-apple-ios"] deployment_target = "17.0" bundle_id_prefix = "id.animo" -dependencies = ["Security.framework", "LocalAuthentication.framework"] +dependencies = ["Security.framework"] [dependencies] mobile_tests = { path = "../mobile_tests" } diff --git a/examples/mobile_tests/src/lib.rs b/examples/mobile_tests/src/lib.rs index ab29e55..203a011 100644 --- a/examples/mobile_tests/src/lib.rs +++ b/examples/mobile_tests/src/lib.rs @@ -35,7 +35,7 @@ pub fn run_tests() { test_generate_and_sign, test_get_by_id_and_get_public_key, - test_get_by_id_and_sign, + test_get_by_id_and_sign ); } @@ -81,6 +81,7 @@ fn test_generate_and_sign() { let key = SecureEnvironment::generate_keypair(id).unwrap(); let msg = b"Hello World!"; + // We check for an error here as the tests cannot do biometrics authentication assert!(key.sign(msg).is_err()); } @@ -90,5 +91,6 @@ fn test_get_by_id_and_sign() { let key = SecureEnvironment::get_keypair_by_id(id).unwrap(); let msg = b"Hello World!"; + // We check for an error here as the tests cannot do biometrics authentication assert!(key.sign(msg).is_err()); } diff --git a/src/android.rs b/src/android.rs index 7577ad2..ac37294 100644 --- a/src/android.rs +++ b/src/android.rs @@ -5,8 +5,8 @@ use crate::{ }; use jni::{ objects::{JByteArray, JClass, JObject, JString, JValue}, - sys::{jint, jobject, JNI_VERSION_1_6}, - JNIEnv, JavaVM, + sys::jobject, + JNIEnv, }; use lazy_static::lazy_static; use libc::c_void; @@ -178,12 +178,20 @@ impl SecureEnvironmentOps for SecureEnvironment { let digest_sha256 = jni_get_static_field!( env, - kp_cls, + &kp_cls, KEY_PROPERTIES_DIGEST_SHA256, l, UnableToGenerateKey )?; + let auth_biometric_strong = jni_get_static_field!( + env, + &kp_cls, + KEY_PROPERTIES_AUTH_BIOMETRIC_STRONG, + i, + UnableToGenerateKey + )?; + let string_cls = jni_find_class!(env, STRING, UnableToGenerateKey)?; let args = env @@ -208,6 +216,33 @@ impl SecureEnvironmentOps for SecureEnvironment { UnableToGenerateKey )?; + let builder = jni_call_method!( + env, + builder, + KEY_GEN_PARAMETER_SPEC_BUILDER_SET_USER_AUTHENTICATION_REQUIRED, + &[JValue::Bool(1)], + l, + UnableToGenerateKey + )?; + + let builder = jni_call_method!( + env, + builder, + KEY_GEN_PARAMETER_SPEC_BUILDER_SET_INVALIDATED_BY_BIOMETRIC_ENROLLMENT, + &[JValue::Bool(1)], + l, + UnableToGenerateKey + )?; + + let builder = jni_call_method!( + env, + builder, + KEY_GEN_PARAMETER_SPEC_BUILDER_SET_USER_AUTHENTICATION_PARAMETERS, + &[JValue::from(0), auth_biometric_strong.into()], + l, + UnableToGenerateKey + )?; + let current_activity_thread = jni_call_static_method!( env, ACTIVITY_THREAD, @@ -506,6 +541,12 @@ impl KeyOps for Key { Ok(public_key) } + /** + * + * Signing is an operation that requires authentication. Make sure to manually authenticate + * before calling this operation + * + */ fn sign(&self, msg: &[u8]) -> SecureEnvResult> { let jvm = JAVA_VM.lock().map_err(|_| { SecureEnvError::UnableToAttachJVMToThread("Could not acquire lock on JVM".to_owned()) diff --git a/src/jni_tokens.rs b/src/jni_tokens.rs index a4d0165..7dd792f 100644 --- a/src/jni_tokens.rs +++ b/src/jni_tokens.rs @@ -21,6 +21,9 @@ pub static PACKAGE_MANAGER_HAS_SYSTEM_FEATURE_SIG: &str = "(Ljava/lang/String;I) pub static KEY_PROPERTIES_CLS: &str = "android/security/keystore/KeyProperties"; +pub static KEY_PROPERTIES_AUTH_BIOMETRIC_STRONG: &str = "AUTH_BIOMETRIC_STRONG"; +pub static KEY_PROPERTIES_AUTH_BIOMETRIC_STRONG_SIG: &str = "I"; + pub static KEY_PROPERTIES_PURPOSE_SIGN: &str = "PURPOSE_SIGN"; pub static KEY_PROPERTIES_PURPOSE_SIGN_SIG: &str = "I"; @@ -42,6 +45,21 @@ pub static KEY_GEN_PARAMETER_SPEC_BUILDER_SET_KEY_SIZE: &str = "setKeySize"; pub static KEY_GEN_PARAMETER_SPEC_BUILDER_SET_KEY_SIZE_SIG: &str = "(I)Landroid/security/keystore/KeyGenParameterSpec$Builder;"; +pub static KEY_GEN_PARAMETER_SPEC_BUILDER_SET_USER_AUTHENTICATION_REQUIRED: &str = + "setUserAuthenticationRequired"; +pub static KEY_GEN_PARAMETER_SPEC_BUILDER_SET_USER_AUTHENTICATION_REQUIRED_SIG: &str = + "(Z)Landroid/security/keystore/KeyGenParameterSpec$Builder;"; + +pub static KEY_GEN_PARAMETER_SPEC_BUILDER_SET_INVALIDATED_BY_BIOMETRIC_ENROLLMENT: &str = + "setInvalidatedByBiometricEnrollment"; +pub static KEY_GEN_PARAMETER_SPEC_BUILDER_SET_INVALIDATED_BY_BIOMETRIC_ENROLLMENT_SIG: &str = + "(Z)Landroid/security/keystore/KeyGenParameterSpec$Builder;"; + +pub static KEY_GEN_PARAMETER_SPEC_BUILDER_SET_USER_AUTHENTICATION_PARAMETERS: &str = + "setUserAuthenticationParameters"; +pub static KEY_GEN_PARAMETER_SPEC_BUILDER_SET_USER_AUTHENTICATION_PARAMETERS_SIG: &str = + "(II)Landroid/security/keystore/KeyGenParameterSpec$Builder;"; + pub static KEY_GEN_PARAMETER_SPEC_BUILDER_SET_IS_STRONG_BOX_BACKED: &str = "setIsStrongBoxBacked"; pub static KEY_GEN_PARAMETER_SPEC_BUILDER_SET_IS_STRONG_BOX_BACKED_SIG: &str = "(Z)Landroid/security/keystore/KeyGenParameterSpec$Builder;";