Skip to content

Commit ea3ceae

Browse files
Android HW Trust Teamcopybara-github
authored andcommitted
Adds support for BLOCK_MODE and RSA_OAEP_MGF_DIGEST tags.
PiperOrigin-RevId: 805412718
1 parent cc9fe59 commit ea3ceae

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/main/kotlin/Extension.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,12 @@ enum class KeyMintTag(val value: Int) {
231231
PURPOSE(1),
232232
ALGORITHM(2),
233233
KEY_SIZE(3),
234+
BLOCK_MODE(4),
234235
DIGEST(5),
235236
PADDING(6),
236237
EC_CURVE(10),
237238
RSA_PUBLIC_EXPONENT(200),
239+
RSA_OAEP_MGF_DIGEST(203),
238240
ACTIVE_DATE_TIME(400),
239241
ORIGINATION_EXPIRE_DATE_TIME(401),
240242
USAGE_EXPIRE_DATE_TIME(402),
@@ -280,12 +282,14 @@ enum class KeyMintTag(val value: Int) {
280282
@Immutable
281283
data class AuthorizationList(
282284
@SuppressWarnings("Immutable") val purposes: Set<BigInteger>? = null,
283-
val keySize: BigInteger? = null,
284285
val algorithms: BigInteger? = null,
286+
val keySize: BigInteger? = null,
287+
@SuppressWarnings("Immutable") val blockModes: Set<BigInteger>? = null,
285288
@SuppressWarnings("Immutable") val digests: Set<BigInteger>? = null,
286289
@SuppressWarnings("Immutable") val paddings: Set<BigInteger>? = null,
287290
val ecCurve: BigInteger? = null,
288291
val rsaPublicExponent: BigInteger? = null,
292+
@SuppressWarnings("Immutable") val rsaOaepMgfDigests: Set<BigInteger>? = null,
289293
val activeDateTime: BigInteger? = null,
290294
val originationExpireDateTime: BigInteger? = null,
291295
val usageExpireDateTime: BigInteger? = null,
@@ -324,10 +328,12 @@ data class AuthorizationList(
324328
purposes?.toAsn1()?.let { add(it.toTaggedObject(KeyMintTag.PURPOSE)) }
325329
algorithms?.toAsn1()?.let { add(it.toTaggedObject(KeyMintTag.ALGORITHM)) }
326330
keySize?.toAsn1()?.let { add(it.toTaggedObject(KeyMintTag.KEY_SIZE)) }
331+
blockModes?.toAsn1()?.let { add(it.toTaggedObject(KeyMintTag.BLOCK_MODE)) }
327332
digests?.toAsn1()?.let { add(it.toTaggedObject(KeyMintTag.DIGEST)) }
328333
paddings?.toAsn1()?.let { add(it.toTaggedObject(KeyMintTag.PADDING)) }
329334
ecCurve?.toAsn1()?.let { add(it.toTaggedObject(KeyMintTag.EC_CURVE)) }
330335
rsaPublicExponent?.toAsn1()?.let { add(it.toTaggedObject(KeyMintTag.RSA_PUBLIC_EXPONENT)) }
336+
rsaOaepMgfDigests?.toAsn1()?.let { add(it.toTaggedObject(KeyMintTag.RSA_OAEP_MGF_DIGEST)) }
331337
activeDateTime?.toAsn1()?.let { add(it.toTaggedObject(KeyMintTag.ACTIVE_DATE_TIME)) }
332338
originationExpireDateTime?.toAsn1()?.let {
333339
add(it.toTaggedObject(KeyMintTag.ORIGINATION_EXPIRE_DATE_TIME))
@@ -420,10 +426,14 @@ data class AuthorizationList(
420426
purposes = objects[KeyMintTag.PURPOSE]?.toSet<ASN1Integer>()?.map { it.value }?.toSet(),
421427
algorithms = objects[KeyMintTag.ALGORITHM]?.toInt(),
422428
keySize = objects[KeyMintTag.KEY_SIZE]?.toInt(),
429+
blockModes =
430+
objects[KeyMintTag.BLOCK_MODE]?.toSet<ASN1Integer>()?.map { it.value }?.toSet(),
423431
digests = objects[KeyMintTag.DIGEST]?.toSet<ASN1Integer>()?.map { it.value }?.toSet(),
424432
paddings = objects[KeyMintTag.PADDING]?.toSet<ASN1Integer>()?.map { it.value }?.toSet(),
425433
ecCurve = objects[KeyMintTag.EC_CURVE]?.toInt(),
426434
rsaPublicExponent = objects[KeyMintTag.RSA_PUBLIC_EXPONENT]?.toInt(),
435+
rsaOaepMgfDigests =
436+
objects[KeyMintTag.RSA_OAEP_MGF_DIGEST]?.toSet<ASN1Integer>()?.map { it.value }?.toSet(),
427437
activeDateTime = objects[KeyMintTag.ACTIVE_DATE_TIME]?.toInt(),
428438
originationExpireDateTime = objects[KeyMintTag.ORIGINATION_EXPIRE_DATE_TIME]?.toInt(),
429439
usageExpireDateTime = objects[KeyMintTag.USAGE_EXPIRE_DATE_TIME]?.toInt(),

0 commit comments

Comments
 (0)