@@ -114,17 +114,17 @@ data class DeviceIdentity(
114114 @JvmStatic
115115 fun parseFrom (description : KeyDescription ) =
116116 DeviceIdentity (
117- description.teeEnforced .attestationIdBrand,
118- description.teeEnforced .attestationIdDevice,
119- description.teeEnforced .attestationIdProduct,
120- description.teeEnforced .attestationIdSerial,
117+ description.hardwareEnforced .attestationIdBrand,
118+ description.hardwareEnforced .attestationIdDevice,
119+ description.hardwareEnforced .attestationIdProduct,
120+ description.hardwareEnforced .attestationIdSerial,
121121 setOfNotNull(
122- description.teeEnforced .attestationIdImei,
123- description.teeEnforced .attestationIdSecondImei,
122+ description.hardwareEnforced .attestationIdImei,
123+ description.hardwareEnforced .attestationIdSecondImei,
124124 ),
125- description.teeEnforced .attestationIdMeid,
126- description.teeEnforced .attestationIdManufacturer,
127- description.teeEnforced .attestationIdModel,
125+ description.hardwareEnforced .attestationIdMeid,
126+ description.hardwareEnforced .attestationIdManufacturer,
127+ description.hardwareEnforced .attestationIdModel,
128128 )
129129 }
130130}
@@ -139,8 +139,7 @@ data class KeyDescription(
139139 val attestationChallenge : ByteString ,
140140 val uniqueId : ByteString ,
141141 val softwareEnforced : AuthorizationList ,
142- // TODO: Rename to hardwareEnforced b/c could be TEE or StrongBox.
143- val teeEnforced : AuthorizationList ,
142+ val hardwareEnforced : AuthorizationList ,
144143) {
145144 fun asExtension (): Extension {
146145 return Extension (OID , /* critical= */ false , encodeToAsn1())
@@ -155,7 +154,7 @@ data class KeyDescription(
155154 add(attestationChallenge.toAsn1())
156155 add(uniqueId.toAsn1())
157156 add(softwareEnforced.toAsn1())
158- add(teeEnforced .toAsn1())
157+ add(hardwareEnforced .toAsn1())
159158 }
160159 .let { DERSequence (it.toTypedArray()).encoded }
161160
@@ -178,7 +177,7 @@ data class KeyDescription(
178177 from(ASN1Sequence .getInstance(bytes))
179178 } catch (e: NullPointerException ) {
180179 // Workaround for a NPE in BouncyCastle.
181- // http ://google3/third_party/java_src/bouncycastle/ core/src/main/java/org/bouncycastle/asn1/ASN1UniversalType.java;l=24;rcl=484684674
180+ // https ://github.com/bcgit/bc-java/blob/228211ecb973fe87fdd0fc4ab16ba0446ec1a29c/ core/src/main/java/org/bouncycastle/asn1/ASN1UniversalType.java#L24
182181 throw IllegalArgumentException (e)
183182 }
184183
@@ -192,7 +191,7 @@ data class KeyDescription(
192191 attestationChallenge = seq.getObjectAt(4 ).toByteString(),
193192 uniqueId = seq.getObjectAt(5 ).toByteString(),
194193 softwareEnforced = seq.getObjectAt(6 ).toAuthorizationList(),
195- teeEnforced = seq.getObjectAt(7 ).toAuthorizationList(),
194+ hardwareEnforced = seq.getObjectAt(7 ).toAuthorizationList(),
196195 )
197196 }
198197 }
@@ -204,14 +203,10 @@ data class KeyDescription(
204203 * @see https://source.android.com/docs/security/features/keystore/attestation#securitylevel-values
205204 */
206205enum class SecurityLevel (val value : Int ) {
207- // LINT.IfChange(security_level)
208206 SOFTWARE (0 ),
209207 TRUSTED_ENVIRONMENT (1 ),
210208 STRONG_BOX (2 );
211209
212- // LINT.ThenChange(//depot/google3/identity/cryptauth/apparat/apparat.proto:key_type,
213- // //depot/google3/identity/cryptauth/apparat/storage/apparat_storage_api.proto:keymaster_security_level)
214-
215210 internal fun toAsn1 () = ASN1Enumerated (value)
216211}
217212
0 commit comments