From bd40f4b950a7dfd99405822085fb874fb713148c Mon Sep 17 00:00:00 2001 From: Enginex0 Date: Tue, 17 Mar 2026 04:36:49 +0100 Subject: [PATCH] fix(attestation): encode PADDING as SET OF INTEGER per AOSP schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PADDING (tag 6) is ENUM_REP in Tag.aidl, meaning SET OF INTEGER in the attestation extension ASN.1 — same as PURPOSE and DIGEST. Commit f8bfa0d added it as individual [6] INTEGER entries, causing parsers to fail with CertificateParsingException on any RSA key attestation. --- .../matrix/TEESimulator/attestation/AttestationBuilder.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/matrix/TEESimulator/attestation/AttestationBuilder.kt b/app/src/main/java/org/matrix/TEESimulator/attestation/AttestationBuilder.kt index a4d0181..166790b 100644 --- a/app/src/main/java/org/matrix/TEESimulator/attestation/AttestationBuilder.kt +++ b/app/src/main/java/org/matrix/TEESimulator/attestation/AttestationBuilder.kt @@ -194,9 +194,13 @@ object AttestationBuilder { ) } - params.padding.forEach { + if (params.padding.isNotEmpty()) { list.add( - DERTaggedObject(true, AttestationConstants.TAG_PADDING, ASN1Integer(it.toLong())) + DERTaggedObject( + true, + AttestationConstants.TAG_PADDING, + DERSet(params.padding.map { ASN1Integer(it.toLong()) }.toTypedArray()), + ) ) }