Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder#inhmethods)

# CredentialDataRequest.Builder

*** ** * ** ***


`
public
static
final

class
CredentialDataRequest.Builder
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.security.identity.CredentialDataRequest.Builder |

<br />

*** ** * ** ***


**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/android/security/identity/CredentialDataRequest`.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder#Builder()() ` *This constructor is deprecated. Use `java.security.KeyStore` with the Android hardware-backed keystore instead.* |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest` | ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder#build()() ` *This method is deprecated. Use `java.security.KeyStore` with the Android hardware-backed keystore instead.* |
| ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder` | ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder#setAllowUsingExhaustedKeys(boolean)(boolean allowUsingExhaustedKeys) ` *This method is deprecated. Use `java.security.KeyStore` with the Android hardware-backed keystore instead.* |
| ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder` | ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder#setAllowUsingExpiredKeys(boolean)(boolean allowUsingExpiredKeys) ` *This method is deprecated. Use `java.security.KeyStore` with the Android hardware-backed keystore instead.* |
| ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder` | ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder#setDeviceSignedEntriesToRequest(java.util.Map<java.lang.String,java.util.Collection<java.lang.String>>)(https://developer.android.com/reference/java/util/Map<https://developer.android.com/reference/java/lang/String, https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/java/lang/String>> entriesToRequest) ` *This method is deprecated. Use `java.security.KeyStore` with the Android hardware-backed keystore instead.* |
| ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder` | ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder#setIncrementUseCount(boolean)(boolean incrementUseCount) ` *This method is deprecated. Use `java.security.KeyStore` with the Android hardware-backed keystore instead.* |
| ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder` | ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder#setIssuerSignedEntriesToRequest(java.util.Map<java.lang.String,java.util.Collection<java.lang.String>>)(https://developer.android.com/reference/java/util/Map<https://developer.android.com/reference/java/lang/String, https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/java/lang/String>> entriesToRequest) ` *This method is deprecated. Use `java.security.KeyStore` with the Android hardware-backed keystore instead.* |
| ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder` | ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder#setReaderSignature(byte[])(byte[] readerSignature) ` *This method is deprecated. Use `java.security.KeyStore` with the Android hardware-backed keystore instead.* |
| ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder` | ` https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder#setRequestMessage(byte[])(byte[] requestMessage) ` *This method is deprecated. Use `java.security.KeyStore` with the Android hardware-backed keystore instead.* |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


## Public constructors

### Builder

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

```
public Builder ()
```


**This constructor is deprecated.**   

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

Creates a new builder.

<br />

## Public methods

### build

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

```
public CredentialDataRequest build ()
```


**This method is deprecated.**   

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

Finishes building a `https://developer.android.com/reference/android/security/identity/CredentialDataRequest`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/security/identity/CredentialDataRequest` | the `https://developer.android.com/reference/android/security/identity/CredentialDataRequest` object. This value cannot be `null`. <br /> |

### setAllowUsingExhaustedKeys

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

```
public CredentialDataRequest.Builder setAllowUsingExhaustedKeys (boolean allowUsingExhaustedKeys)
```


**This method is deprecated.**   

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

Sets whether to allow using an authentication key which use count has been exceeded.

This is useful in situations where the application hasn't had a chance to renew
authentication keys, for example if the device hasn't been connected to the Internet or
if the issuing authority server has been down.

The reason this could be useful is that the privacy risk of reusing an authentication
key for a credential presentation could be significantly smaller compared to the
inconvenience of not being able to present the credential at all.

By default this is set to true.

<br />

| Parameters ||
|---|---|
| `allowUsingExhaustedKeys` | `boolean`: whether to allow using an authentication key which use count has been exceeded if no other key is available. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder` | the builder. This value cannot be `null`. <br /> |

### setAllowUsingExpiredKeys

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

```
public CredentialDataRequest.Builder setAllowUsingExpiredKeys (boolean allowUsingExpiredKeys)
```


**This method is deprecated.**   

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

Sets whether to allow using an authentication key which is expired.

This is useful in situations where the application hasn't had a chance to renew
authentication keys, for example if the device hasn't been connected to the Internet or
if the issuing authority server has been down.

The reason this could be useful is that many verifiers are likely to accept a
credential presentation using an expired authentication key (the credential itself
wouldn't be expired) and it's likely better for the holder to be able to do this than
not present their credential at all.

By default this is set to false.

<br />

| Parameters ||
|---|---|
| `allowUsingExpiredKeys` | `boolean`: whether to allow using an authentication key which is expired if no other key is available. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder` | the builder. This value cannot be `null`. <br /> |

### setDeviceSignedEntriesToRequest

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

```
public CredentialDataRequest.Builder setDeviceSignedEntriesToRequest (Map<String, Collection<String>> entriesToRequest)
```


**This method is deprecated.**   

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

Sets the device-signed entries to request.

<br />

| Parameters ||
|---|---|
| `entriesToRequest` | `Map`: the device-signed entries to request. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder` | This value cannot be `null`. <br /> |

### setIncrementUseCount

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

```
public CredentialDataRequest.Builder setIncrementUseCount (boolean incrementUseCount)
```


**This method is deprecated.**   

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

Sets whether to increment the use-count for the authentication key used.

Not incrementing the use-count for an authentication key is useful in situations
where the authentication key is known with certainty to not be leaked. For example,
consider an application doing a credential presentation for the sole purpose of
displaying the credential data to the user (not for verification).

By default this is set to true.

<br />

| Parameters ||
|---|---|
| `incrementUseCount` | `boolean`: whether to increment the use count of the authentication key used. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder` | the builder. This value cannot be `null`. <br /> |

### setIssuerSignedEntriesToRequest

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

```
public CredentialDataRequest.Builder setIssuerSignedEntriesToRequest (Map<String, Collection<String>> entriesToRequest)
```


**This method is deprecated.**   

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

Sets the issuer-signed entries to request.

<br />

| Parameters ||
|---|---|
| `entriesToRequest` | `Map`: the issuer-signed entries to request. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder` | the builder. This value cannot be `null`. <br /> |

### setReaderSignature

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

```
public CredentialDataRequest.Builder setReaderSignature (byte[] readerSignature)
```


**This method is deprecated.**   

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

Sets the reader signature.

This data structure is described in the documentation for the
`https://developer.android.com/reference/android/security/identity/PresentationSession#getCredentialData(java.lang.String,%20android.security.identity.CredentialDataRequest)` method.

<br />

| Parameters ||
|---|---|
| `readerSignature` | `byte`: a `COSE_Sign1` structure as described above. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder` | the builder. This value cannot be `null`. <br /> |

### setRequestMessage

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

```
public CredentialDataRequest.Builder setRequestMessage (byte[] requestMessage)
```


**This method is deprecated.**   

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

Sets the request message CBOR.

This data structure is described in the documentation for the
`https://developer.android.com/reference/android/security/identity/PresentationSession#getCredentialData(java.lang.String,%20android.security.identity.CredentialDataRequest)` method.

<br />

| Parameters ||
|---|---|
| `requestMessage` | `byte`: the request message CBOR as described above. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/security/identity/CredentialDataRequest.Builder` | the builder. This value cannot be `null`. <br /> |