Language

KeyChain.IsBoundKeyAlgorithm(String) Method

Definition

Caution

deprecated

Returns a legacy indication of hardware support for the specified key algorithm.

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

Parameters

algorithm
String

The key algorithm name for the legacy hardware-support check, such as RSA.

Returns

A legacy indication of hardware support for the algorithm. In the Android 12 and Android 16 implementations, this method always returns true, regardless of the algorithm. The result does not determine whether an individual key is hardware-backed; inspect that key's KeyInfo instead.

Attributes

Remarks

On Android 8, this method checks whether the algorithm is supported and hardware-backed. Other Android versions can return a different result.

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