Udostępnij za pośrednictwem


KeyStore.GetInstance Method

Definition

Overloads

GetInstance(String, Provider)

Returns a keystore object of the specified type.

GetInstance(File, Char[])

Returns a loaded keystore object of the appropriate keystore type.

GetInstance(String, String)

Returns a keystore object of the specified type.

GetInstance(String)

Returns a keystore object of the specified type.

GetInstance(File, KeyStore+ILoadStoreParameter)

GetInstance(String, Provider)

Returns a keystore object of the specified type.

[Android.Runtime.Register("getInstance", "(Ljava/lang/String;Ljava/security/Provider;)Ljava/security/KeyStore;", "")]
public static Java.Security.KeyStore? GetInstance (string? type, Java.Security.Provider? provider);
[<Android.Runtime.Register("getInstance", "(Ljava/lang/String;Ljava/security/Provider;)Ljava/security/KeyStore;", "")>]
static member GetInstance : string * Java.Security.Provider -> Java.Security.KeyStore

Parameters

type
String

the type of keystore. See the KeyStore section in the Java Security Standard Algorithm Names Specification for information about standard keystore types.

provider
Provider

the provider.

Returns

a keystore object of the specified type

Attributes

Exceptions

if an error occurred during the creation of the new KeyStore.

if provider is null or the empty string.

if type == null (instead of NoSuchAlgorithmException) as in 1.4 release

Remarks

Returns a keystore object of the specified type.

A new KeyStore object encapsulating the KeyStoreSpi implementation from the specified Provider object is returned. Note that the specified Provider object does not have to be registered in the provider list.

Added in 1.4.

Java documentation for java.security.KeyStore.getInstance(java.lang.String, java.security.Provider).

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.

See also

Applies to

GetInstance(File, Char[])

Returns a loaded keystore object of the appropriate keystore type.

[Android.Runtime.Register("getInstance", "(Ljava/io/File;[C)Ljava/security/KeyStore;", "", ApiSince=33)]
public static Java.Security.KeyStore? GetInstance (Java.IO.File? file, char[]? password);
[<Android.Runtime.Register("getInstance", "(Ljava/io/File;[C)Ljava/security/KeyStore;", "", ApiSince=33)>]
static member GetInstance : Java.IO.File * char[] -> Java.Security.KeyStore

Parameters

file
File

the keystore file

password
Char[]

the keystore password, which may be null

Returns

a keystore object loaded with keystore data

Attributes

Remarks

Returns a loaded keystore object of the appropriate keystore type. First the keystore type is determined by probing the specified file. Then a keystore object is instantiated and loaded using the data from that file.

A password may be given to unlock the keystore (e.g. the keystore resides on a hardware token device), or to check the integrity of the keystore data. If a password is not given for integrity checking, then integrity checking is not performed.

This method traverses the list of registered security Provider providers, starting with the most preferred Provider. For each KeyStoreSpi implementation supported by a Provider, it invokes the KeyStoreSpi#engineProbe(InputStream) engineProbe method to determine if it supports the specified keystore. A new KeyStore object is returned that encapsulates the KeyStoreSpi implementation from the first Provider that supports the specified file.

Note that the list of registered providers may be retrieved via the Security#getProviders() Security.getProviders() method.

Added in 9.

Java documentation for java.security.KeyStore.getInstance(java.io.File, char[]).

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

GetInstance(String, String)

Returns a keystore object of the specified type.

[Android.Runtime.Register("getInstance", "(Ljava/lang/String;Ljava/lang/String;)Ljava/security/KeyStore;", "")]
public static Java.Security.KeyStore? GetInstance (string? type, string? provider);
[<Android.Runtime.Register("getInstance", "(Ljava/lang/String;Ljava/lang/String;)Ljava/security/KeyStore;", "")>]
static member GetInstance : string * string -> Java.Security.KeyStore

Parameters

type
String

the type of keystore. See the KeyStore section in the Java Security Standard Algorithm Names Specification for information about standard keystore types.

provider
String

the name of the provider.

Returns

a keystore object of the specified type

Attributes

Exceptions

if an error occurred during the creation of the new KeyStore.

if the specified provider is not available.

if provider == null || provider.isEmpty()

if type is null (instead of NoSuchAlgorithmException) as in 1.4 release

Remarks

Returns a keystore object of the specified type.

A new KeyStore object encapsulating the KeyStoreSpi implementation from the specified provider is returned. The specified provider must be registered in the security provider list.

Note that the list of registered providers may be retrieved via the Security#getProviders() Security.getProviders() method.

Java documentation for java.security.KeyStore.getInstance(java.lang.String, 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.

See also

Applies to

GetInstance(String)

Returns a keystore object of the specified type.

[Android.Runtime.Register("getInstance", "(Ljava/lang/String;)Ljava/security/KeyStore;", "")]
public static Java.Security.KeyStore? GetInstance (string? type);
[<Android.Runtime.Register("getInstance", "(Ljava/lang/String;)Ljava/security/KeyStore;", "")>]
static member GetInstance : string -> Java.Security.KeyStore

Parameters

type
String

the type of keystore. See the KeyStore section in the Java Security Standard Algorithm Names Specification for information about standard keystore types.

Returns

a keystore object of the specified type

Attributes

Exceptions

if an error occurred during the creation of the new KeyStore.

if type == null

Remarks

Returns a keystore object of the specified type.

This method traverses the list of registered security Providers, starting with the most preferred Provider. A new KeyStore object encapsulating the KeyStoreSpi implementation from the first Provider that supports the specified type is returned.

Note that the list of registered providers may be retrieved via the Security#getProviders() Security.getProviders() method.

Java documentation for java.security.KeyStore.getInstance(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.

See also

Applies to

GetInstance(File, KeyStore+ILoadStoreParameter)

[Android.Runtime.Register("getInstance", "(Ljava/io/File;Ljava/security/KeyStore$LoadStoreParameter;)Ljava/security/KeyStore;", "", ApiSince=33)]
public static Java.Security.KeyStore? GetInstance (Java.IO.File? file, Java.Security.KeyStore.ILoadStoreParameter? param);
[<Android.Runtime.Register("getInstance", "(Ljava/io/File;Ljava/security/KeyStore$LoadStoreParameter;)Ljava/security/KeyStore;", "", ApiSince=33)>]
static member GetInstance : Java.IO.File * Java.Security.KeyStore.ILoadStoreParameter -> Java.Security.KeyStore

Parameters

file
File

Returns

Attributes

Applies to