Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

```
class Builder
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.security.identity.AccessControlProfile.Builder](https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile.Builder#) |

*** ** * ** ***

> [!CAUTION]
> **This class was deprecated in API level 37.2.**
>
> Use `java.security.KeyStore` with the Android hardware-backed keystore instead.

A builder for `https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile`.

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile.Builder#Builder(android.security.identity.AccessControlProfileId)(accessControlProfileId: https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfileId)` Each access control profile has numeric identifier that must be unique within the context of a Credential and may be used to reference the profile. |

| Public methods ||
|---|---|
| [AccessControlProfile](https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile) | `https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile.Builder#build()()` Creates a new `https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile` from the data supplied to the builder. |
| [AccessControlProfile.Builder](https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile.Builder#) | `https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile.Builder#setReaderCertificate(java.security.cert.X509Certificate)(readerCertificate: https://developer.android.com/reference/kotlin/java/security/cert/X509Certificate.html#)` Sets the reader certificate to use when checking access control. |
| [AccessControlProfile.Builder](https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile.Builder#) | `https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile.Builder#setUserAuthenticationRequired(kotlin.Boolean)(userAuthenticationRequired: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Set whether user authentication is required. |
| [AccessControlProfile.Builder](https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile.Builder#) | `https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile.Builder#setUserAuthenticationTimeout(kotlin.Long)(userAuthenticationTimeoutMillis: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Sets the authentication timeout to use. |

## Public constructors

### Builder

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
Builder(accessControlProfileId: AccessControlProfileId)
```

**Deprecated:** *Use `java.security.KeyStore` with the Android hardware-backed keystore instead.*

Each access control profile has numeric identifier that must be unique within the context of a Credential and may be used to reference the profile.

By default, the resulting `https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile` will require user authentication with a timeout of zero, thus requiring the holder to authenticate for every presentation where data elements using this access control profile is used.

| Parameters ||
|---|---|
| `accessControlProfileId` | [AccessControlProfileId](https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfileId): the access control profile identifier. This value cannot be `null`. |

## Public methods

### build

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun build(): AccessControlProfile
```

**Deprecated:** *Use `java.security.KeyStore` with the Android hardware-backed keystore instead.*

Creates a new `https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile` from the data supplied to the builder.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile` | The created `https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile` object. This value cannot be `null`. |

### setReaderCertificate

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setReaderCertificate(readerCertificate: X509Certificate): AccessControlProfile.Builder
```

**Deprecated:** *Use `java.security.KeyStore` with the Android hardware-backed keystore instead.*

Sets the reader certificate to use when checking access control.

If set, this is checked against the certificate chain presented by reader. The access check is fulfilled only if one of the certificates in the chain, matches the certificate set by this method.

| Parameters ||
|---|---|
| `readerCertificate` | [X509Certificate](https://developer.android.com/reference/kotlin/java/security/cert/X509Certificate.html#): the certificate to use for the access control check. This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile.Builder#` | The builder. This value cannot be `null`. |

### setUserAuthenticationRequired

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setUserAuthenticationRequired(userAuthenticationRequired: Boolean): AccessControlProfile.Builder
```

**Deprecated:** *Use `java.security.KeyStore` with the Android hardware-backed keystore instead.*

Set whether user authentication is required.

This should be used sparingly since disabling user authentication on just a single data element can easily create a [Relay Attack](https://en.wikipedia.org/wiki/Relay_attack) if the device on which the credential is stored is compromised.

| Parameters ||
|---|---|
| `userAuthenticationRequired` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): Set to true if user authentication is required, false otherwise. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile.Builder#` | The builder. This value cannot be `null`. |

### setUserAuthenticationTimeout

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setUserAuthenticationTimeout(userAuthenticationTimeoutMillis: Long): AccessControlProfile.Builder
```

**Deprecated:** *Use `java.security.KeyStore` with the Android hardware-backed keystore instead.*

Sets the authentication timeout to use.

The authentication timeout specifies the amount of time, in milliseconds, for which a user authentication is valid, if user authentication is required (see `https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile.Builder#setUserAuthenticationRequired(kotlin.Boolean)`).

If the timeout is zero, then authentication is always required for each reader session.

| Parameters ||
|---|---|
| `userAuthenticationTimeoutMillis` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): the authentication timeout, in milliseconds. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/security/identity/AccessControlProfile.Builder#` | The builder. This value cannot be `null`. |