Share via


KeyChain.IsBoundKeyAlgorithm(String) Method

Definition

Returns true if the current device's KeyChain binds any PrivateKey of the given algorithm to the device once imported or generated.

[Android.Runtime.Register("isBoundKeyAlgorithm", "(Ljava/lang/String;)Z", "")]
public static bool IsBoundKeyAlgorithm (string algorithm);
[<Android.Runtime.Register("isBoundKeyAlgorithm", "(Ljava/lang/String;)Z", "")>]
static member IsBoundKeyAlgorithm : string -> bool

Parameters

algorithm
String

Returns

Attributes

Remarks

Returns true if the current device's KeyChain binds any PrivateKey of the given algorithm to the device once imported or generated. This can be used to tell if there is special hardware support that can be used to bind keys to the device in a way that makes it non-exportable.

This member is deprecated. Whether the key is bound to the secure hardware is known only once the key has been imported. To find out, use: <pre>PrivateKey key = ...; // private key from KeyChain

KeyFactory keyFactory = KeyFactory.getInstance(key.getAlgorithm(), "AndroidKeyStore"); KeyInfo keyInfo = keyFactory.getKeySpec(key, KeyInfo.class); if (keyInfo.isInsideSecureHardware()) { // The key is bound to the secure hardware of this Android}</pre>

Java documentation for android.security.KeyChain.isBoundKeyAlgorithm(java.lang.String).

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