KeyInfo Class

Definition

Information about a key from the Android Keystore system.

[Android.Runtime.Register("android/security/keystore/KeyInfo", ApiSince=23, DoNotGenerateAcw=true)]
public class KeyInfo : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.Security.Spec.IKeySpec
[<Android.Runtime.Register("android/security/keystore/KeyInfo", ApiSince=23, DoNotGenerateAcw=true)>]
type KeyInfo = class
    inherit Object
    interface IKeySpec
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
KeyInfo
Attributes
Implements

Remarks

Information about a key from the Android Keystore system. This class describes whether the key material is available in plaintext outside of secure hardware, whether user authentication is required for using the key and whether this requirement is enforced by secure hardware, the key's origin, what uses the key is authorized for (e.g., only in GCM mode, or signing only), whether the key should be encrypted at rest, the key's and validity start and end dates.

Instances of this class are immutable.

<h3>Example: Symmetric Key</h3> The following example illustrates how to obtain a KeyInfo describing the provided Android Keystore SecretKey.

{@code
            SecretKey key = ...; // Android Keystore key

            SecretKeyFactory factory = SecretKeyFactory.getInstance(key.getAlgorithm(), "AndroidKeyStore");
            KeyInfo keyInfo;
            try {
                keyInfo = (KeyInfo) factory.getKeySpec(key, KeyInfo.class);
            } catch (InvalidKeySpecException e) {
                // Not an Android KeyStore key.
            }}

<h3>Example: Private Key</h3> The following example illustrates how to obtain a KeyInfo describing the provided Android KeyStore PrivateKey.

{@code
            PrivateKey key = ...; // Android KeyStore key

            KeyFactory factory = KeyFactory.getInstance(key.getAlgorithm(), "AndroidKeyStore");
            KeyInfo keyInfo;
            try {
                keyInfo = factory.getKeySpec(key, KeyInfo.class);
            } catch (InvalidKeySpecException e) {
                // Not an Android KeyStore key.
            }}

Java documentation for android.security.keystore.KeyInfo.

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.

Constructors

KeyInfo(IntPtr, JniHandleOwnership)

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsInsideSecureHardware

Returns true if the key resides inside secure hardware (e.

IsInvalidatedByBiometricEnrollment

Returns true if the key will be invalidated by enrollment of a new fingerprint or removal of all fingerprints.

IsTrustedUserPresenceRequired

Returns true if the key can only be only be used if a test for user presence has succeeded since Signature.

IsUserAuthenticationRequired

Returns true if the key is authorized to be used only if the user has been authenticated.

IsUserAuthenticationRequirementEnforcedBySecureHardware

Returns true if the requirement that this key can only be used if the user has been authenticated is enforced by secure hardware (e.

IsUserAuthenticationValidWhileOnBody

Returns true if this key will become unusable when the device is removed from the user's body.

IsUserConfirmationRequired

Returns true if the key is authorized to be used only for messages confirmed by the user.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
KeySize

Gets the size of the key in bits.

KeystoreAlias

Gets the entry alias under which the key is stored in the AndroidKeyStore.

KeyValidityForConsumptionEnd

Gets the time instant after which the key is no long valid for decryption and verification.

KeyValidityForOriginationEnd

Gets the time instant after which the key is no long valid for encryption and signing.

KeyValidityStart

Gets the time instant before which the key is not yet valid.

PeerReference (Inherited from Object)
Purposes

Gets the set of purposes (e.

RemainingUsageCount

Returns the remaining number of times the key is allowed to be used or KeyProperties#UNRESTRICTED_USAGE_COUNT if there's no restriction on the number of times the key can be used.

SecurityLevel

Returns the security level that the key is protected by.

ThresholdClass
ThresholdType
UserAuthenticationType

Gets the acceptable user authentication types for which this key can be authorized to be used.

UserAuthenticationValidityDurationSeconds

Gets the duration of time (seconds) for which this key is authorized to be used after the user is successfully authenticated.

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

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

(Inherited from Object)
GetBlockModes()

Gets the set of block modes (e.

GetDigests()

Gets the set of digest algorithms (e.

GetEncryptionPaddings()

Gets the set of padding schemes (e.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetSignaturePaddings()

Gets the set of padding schemes (e.

JavaFinalize()

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

(Inherited from Object)
Notify()

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

(Inherited from Object)
NotifyAll()

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

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64)

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

(Inherited from Object)
Wait(Int64, Int32)

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

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to