Langue

KeyGenParameterSpec.Builder.SetUserAuthenticationValidWhileOnBody Method

Definition

Sets whether the key will remain authorized only until the device is removed from the user's body up to the limit of the authentication validity period (see setUserAuthenticationValidityDurationSeconds(int) and setUserAuthenticationRequired(boolean)).

[Android.Runtime.Register("setUserAuthenticationValidWhileOnBody", "(Z)Landroid/security/keystore/KeyGenParameterSpec$Builder;", "", ApiSince=24)]
public Android.Security.Keystore.KeyGenParameterSpec.Builder SetUserAuthenticationValidWhileOnBody(bool remainsValid);
[<Android.Runtime.Register("setUserAuthenticationValidWhileOnBody", "(Z)Landroid/security/keystore/KeyGenParameterSpec$Builder;", "", ApiSince=24)>]
member this.SetUserAuthenticationValidWhileOnBody : bool -> Android.Security.Keystore.KeyGenParameterSpec.Builder

Parameters

remainsValid
Boolean

if true, and if the device supports enforcement of this parameter, the key will be invalidated when the device is removed from the user's body or when the authentication validity expires, whichever occurs first.

Returns

Attributes

Remarks

Sets whether the key will remain authorized only until the device is removed from the user's body up to the limit of the authentication validity period (see setUserAuthenticationValidityDurationSeconds(int) and setUserAuthenticationRequired(boolean)). Once the device has been removed from the user's body, the key will be considered unauthorized and the user will need to re-authenticate to use it. If the device does not have an on-body sensor or the key does not have an authentication validity period, this parameter has no effect.

Since Android 12 (API level 31), this parameter has no effect even on devices that have an on-body sensor. A future version of Android may restore enforcement of this parameter. Meanwhile, it is recommended to not use it.

Android reference for android.security.keystore.KeyGenParameterSpec.Builder.setUserAuthenticationValidWhileOnBody.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to