fix(attestation): correct leaf CN casing and enforce keystore2 parameter policy

Leaf cert Subject CN used "KeyStore" (capital S) but AOSP
KeyGenParameterSpec uses "Keystore" (lowercase s). Fixed in both
the Rust native certgen and BouncyCastle paths.

Replicate keystore2's security_level.rs parameter validation for
software-generated keys: reject CREATION_DATETIME (output-only tag,
ResponseCode 20) and device ID attestation tags (CANNOT_ATTEST_IDS
-66) that real keystore2 blocks before they reach the HAL.

Also fix createErrorReply parcel write order, AIDL protocol expects
exception_code, message, error_code but we had message and error_code
swapped, causing malformed replies for positive error codes.
This commit is contained in:
Enginex0
2026-03-10 14:23:33 +01:00
parent 9807f89b71
commit 4a96491e63
4 changed files with 17 additions and 3 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ fn build_leaf_cert(
let subject_dn_der = if let Some(ref subject) = params.cert_subject {
subject.clone()
} else {
encode_simple_cn_dn("Android KeyStore Key")
encode_simple_cn_dn("Android Keystore Key")
};
// Validity