Merge "Update semantics of on-body Keystore API." into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c152fc15a9
@@ -596,10 +596,10 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns {@code true} if the key will remain authorized while the device is on the user's
|
* Returns {@code true} if the key will remain authorized only until the device is removed from
|
||||||
* body, even after the validity duration has expired. This option has no effect on keys that
|
* the user's body, up to the validity duration. This option has no effect on keys that don't
|
||||||
* don't have an authentication validity duration, and has no effect if the device lacks a
|
* have an authentication validity duration, and has no effect if the device lacks an on-body
|
||||||
* secure on-body sensor.
|
* sensor.
|
||||||
*
|
*
|
||||||
* <p>Authorization applies only to secret key and private key operations. Public key operations
|
* <p>Authorization applies only to secret key and private key operations. Public key operations
|
||||||
* are not restricted.
|
* are not restricted.
|
||||||
@@ -1104,26 +1104,21 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the key is authorized for use after the authentication validity period is
|
* Sets whether the key will remain authorized only until the device is removed from the
|
||||||
* expired (see {@link #setUserAuthenticationValidityDurationSeconds} and {@link
|
* user's body up to the limit of the authentication validity period (see
|
||||||
* #setUserAuthenticationRequired}) if the device has a secure on-body sensor and if the
|
* {@link #setUserAuthenticationValidityDurationSeconds} and
|
||||||
* device has not been removed from the user's body since the last successful
|
* {@link #setUserAuthenticationRequired}). Once the device has been removed from the
|
||||||
* authentication.
|
* user's body, the key will be considered unauthorized and the user will need to
|
||||||
|
* re-authenticate to use it. For keys without an authentication validity period this
|
||||||
|
* parameter has no effect.
|
||||||
*
|
*
|
||||||
* <p>On devices that do not have a secure on-body sensor, creating a key with this
|
* <p>Similarly, on devices that do not have an on-body sensor, this parameter will have no
|
||||||
* parameter set to {@code true} will have no effect; the private or secret key will no
|
* effect; the device will always be considered to be "on-body" and the key will therefore
|
||||||
* longer be authorized for use after the validity period ends, and a fresh authentication
|
* remain authorized until the validity period ends.
|
||||||
* will be required to use it again.
|
|
||||||
*
|
*
|
||||||
* <p>Note that "secure" on-body sensors are required by Android to have a secure path to
|
* @param remainsValid if {@code true}, and if the device supports on-body detection, key
|
||||||
* the secure hardware, but the sensors themselves may not be difficult to fool. It is
|
* will be invalidated when the device is removed from the user's body or when the
|
||||||
* recommended that this feature be used to increase slightly the security of keys which
|
* authentication validity expires, whichever occurs first.
|
||||||
* would otherwise have to allow unauthenticated access, or have a very long validity
|
|
||||||
* period. Keys that require high assurance of user authorization should not use this
|
|
||||||
* feature and should set a short validity period.
|
|
||||||
*
|
|
||||||
* @param remainsValid if {@code true}, and if the device supports secure on-body detection,
|
|
||||||
* key will remain valid after authentication validity duration has expired.
|
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public Builder setUserAuthenticationValidWhileOnBody(boolean remainsValid) {
|
public Builder setUserAuthenticationValidWhileOnBody(boolean remainsValid) {
|
||||||
|
|||||||
@@ -285,10 +285,10 @@ public class KeyInfo implements KeySpec {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns {@code true} if this key will remain usable after its specified validity duration
|
* Returns {@code true} if this key will become unusable when the device is removed from the
|
||||||
* for as long as the device remains on the user's body. This is possible only for keys with
|
* user's body. This is possible only for keys with a specified validity duration, and only on
|
||||||
* a specified validity duration. Always returns {@code false} on devices that lack a secure
|
* devices with an on-body sensor. Always returns {@code false} on devices that lack an on-body
|
||||||
* on-body sensor.
|
* sensor.
|
||||||
*/
|
*/
|
||||||
public boolean isUserAuthenticationValidWhileOnBody() {
|
public boolean isUserAuthenticationValidWhileOnBody() {
|
||||||
return mUserAuthenticationValidWhileOnBody;
|
return mUserAuthenticationValidWhileOnBody;
|
||||||
|
|||||||
@@ -407,10 +407,9 @@ public final class KeyProtection implements ProtectionParameter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns {@code true} if the key will remain authorized while the device is on the user's
|
* Returns {@code true} if the key will be de-authorized when the device is removed from the
|
||||||
* body, even after the validity duration has expired. This option has no effect on keys that
|
* user's body. This option has no effect on keys that don't have an authentication validity
|
||||||
* don't have an authentication validity duration, and has no effect if the device lacks a
|
* duration, and has no effect if the device lacks an on-body sensor.
|
||||||
* secure on-body sensor.
|
|
||||||
*
|
*
|
||||||
* <p>Authorization applies only to secret key and private key operations. Public key operations
|
* <p>Authorization applies only to secret key and private key operations. Public key operations
|
||||||
* are not restricted.
|
* are not restricted.
|
||||||
@@ -728,26 +727,21 @@ public final class KeyProtection implements ProtectionParameter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the key is authorized for use after the authentication validity period is
|
* Sets whether the key will remain authorized only until the device is removed from the
|
||||||
* expired (see {@link #setUserAuthenticationValidityDurationSeconds} and {@link
|
* user's body up to the limit of the authentication validity period (see
|
||||||
* #setUserAuthenticationRequired}) if the device has a secure on-body sensor and if the
|
* {@link #setUserAuthenticationValidityDurationSeconds} and
|
||||||
* device has not been removed from the user's body since the last successful
|
* {@link #setUserAuthenticationRequired}). Once the device has been removed from the
|
||||||
* authentication.
|
* user's body, the key will be considered unauthorized and the user will need to
|
||||||
|
* re-authenticate to use it. For keys without an authentication validity period this
|
||||||
|
* parameter has no effect.
|
||||||
*
|
*
|
||||||
* <p>On devices that do not have a secure on-body sensor, creating a key with this
|
* <p>Similarly, on devices that do not have an on-body sensor, this parameter will have no
|
||||||
* parameter set to {@code true} will have no effect; the private or secret key will no
|
* effect; the device will always be considered to be "on-body" and the key will therefore
|
||||||
* longer be authorized for use after the validity period ends, and a fresh authentication
|
* remain authorized until the validity period ends.
|
||||||
* will be required to use it again.
|
|
||||||
*
|
*
|
||||||
* <p>Note that "secure" on-body sensors are required by Android to have a secure path to
|
* @param remainsValid if {@code true}, and if the device supports on-body detection, key
|
||||||
* the secure hardware, but the sensors themselves may not be difficult to fool. It is
|
* will be invalidated when the device is removed from the user's body or when the
|
||||||
* recommended that this feature be used to increase slightly the security of keys which
|
* authentication validity expires, whichever occurs first.
|
||||||
* would otherwise have to allow unauthenticated access, or have a very long validity
|
|
||||||
* period. Keys that require high assurance of user authorization should not use this
|
|
||||||
* feature and should set a short validity period.
|
|
||||||
*
|
|
||||||
* @param remainsValid if {@code true}, and if the device supports secure on-body detection,
|
|
||||||
* key will remain valid after authentication validity duration has expired.
|
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public Builder setUserAuthenticationValidWhileOnBody(boolean remainsValid) {
|
public Builder setUserAuthenticationValidWhileOnBody(boolean remainsValid) {
|
||||||
|
|||||||
Reference in New Issue
Block a user