summaryrefslogtreecommitdiff
path: root/keystore2/test_utils
diff options
context:
space:
mode:
authorJames Willcox <jwillcox@google.com>2023-10-03 21:31:31 +0000
committerJames Willcox <jwillcox@google.com>2023-10-31 20:30:50 +0000
commitd215da817ad9e1e42473e48416afb3fb11d85b54 (patch)
tree0cbf8a96ec27afaecb598824b540aec4bf49ac55 /keystore2/test_utils
parent449c3b2cec7fbd0feac97aad4949c9fab1282069 (diff)
downloadsecurity-d215da817ad9e1e42473e48416afb3fb11d85b54.tar.gz
Add getLastAuthTime() to IKeystoreAuthorization
This returns the time (from CLOCK_MONOTONIC_RAW) that the specified user last authenticated using the given authenticator. Bug: 303839446 Test: atest keystore2_client_tests Change-Id: Idd4c477365ffa556b7985d1d926dfa554680ff28
Diffstat (limited to 'keystore2/test_utils')
-rw-r--r--keystore2/test_utils/Android.bp1
-rw-r--r--keystore2/test_utils/lib.rs7
2 files changed, 8 insertions, 0 deletions
diff --git a/keystore2/test_utils/Android.bp b/keystore2/test_utils/Android.bp
index a3c40cb4..c16aa124 100644
--- a/keystore2/test_utils/Android.bp
+++ b/keystore2/test_utils/Android.bp
@@ -39,6 +39,7 @@ rust_defaults {
"libserde",
"libserde_cbor",
"libthiserror",
+ "android.security.authorization-rust",
],
static_libs: [
"libkeystore2_ffi_test_utils",
diff --git a/keystore2/test_utils/lib.rs b/keystore2/test_utils/lib.rs
index a373a2fa..8394ca1c 100644
--- a/keystore2/test_utils/lib.rs
+++ b/keystore2/test_utils/lib.rs
@@ -20,6 +20,7 @@ use std::path::{Path, PathBuf};
use std::{env::temp_dir, ops::Deref};
use android_system_keystore2::aidl::android::system::keystore2::IKeystoreService::IKeystoreService;
+use android_security_authorization::aidl::android::security::authorization::IKeystoreAuthorization::IKeystoreAuthorization;
pub mod authorizations;
pub mod ffi_test_utils;
@@ -27,6 +28,7 @@ pub mod key_generations;
pub mod run_as;
static KS2_SERVICE_NAME: &str = "android.system.keystore2.IKeystoreService/default";
+static AUTH_SERVICE_NAME: &str = "android.security.authorization";
/// Represents the lifecycle of a temporary directory for testing.
#[derive(Debug)]
@@ -116,3 +118,8 @@ impl Deref for PathBuilder {
pub fn get_keystore_service() -> binder::Strong<dyn IKeystoreService> {
binder::get_interface(KS2_SERVICE_NAME).unwrap()
}
+
+/// Get Keystore auth service.
+pub fn get_keystore_auth_service() -> binder::Strong<dyn IKeystoreAuthorization> {
+ binder::get_interface(AUTH_SERVICE_NAME).unwrap()
+}