Share via


Cipher.GetInstance Method

Definition

Overloads

GetInstance(String)

Returns a Cipher object that implements the specified transformation.

GetInstance(String, Provider)

Returns a Cipher object that implements the specified transformation.

GetInstance(String, String)

Returns a Cipher object that implements the specified transformation.

GetInstance(String)

Returns a Cipher object that implements the specified transformation.

[Android.Runtime.Register("getInstance", "(Ljava/lang/String;)Ljavax/crypto/Cipher;", "")]
public static Javax.Crypto.Cipher? GetInstance (string? transformation);
[<Android.Runtime.Register("getInstance", "(Ljava/lang/String;)Ljavax/crypto/Cipher;", "")>]
static member GetInstance : string -> Javax.Crypto.Cipher

Parameters

transformation
String

the name of the transformation, e.g., DES/CBC/PKCS5Padding. See the Cipher section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard transformation names.

Returns

a cipher that implements the requested transformation.

Attributes

Exceptions

if no installed provider can provide the transformation, or it is null, empty or in an invalid format.

if no installed provider can provide the padding scheme in the transformation.

Remarks

Returns a Cipher object that implements the specified transformation.

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

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

Java documentation for javax.crypto.Cipher.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.

Applies to

GetInstance(String, Provider)

Returns a Cipher object that implements the specified transformation.

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

Parameters

transformation
String

the name of the transformation, e.g., DES/CBC/PKCS5Padding. See the Cipher section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard transformation names.

provider
Provider

the provider.

Returns

a cipher that implements the requested transformation.

Attributes

Exceptions

if the specified provider can not provide the transformation, or it is null, empty or in an invalid format.

if the requested padding scheme in the transformation is not available.

if the provider is null.

Remarks

Returns a Cipher object that implements the specified transformation.

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

Java documentation for javax.crypto.Cipher.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.

Applies to

GetInstance(String, String)

Returns a Cipher object that implements the specified transformation.

[Android.Runtime.Register("getInstance", "(Ljava/lang/String;Ljava/lang/String;)Ljavax/crypto/Cipher;", "")]
public static Javax.Crypto.Cipher? GetInstance (string? transformation, string? provider);
[<Android.Runtime.Register("getInstance", "(Ljava/lang/String;Ljava/lang/String;)Ljavax/crypto/Cipher;", "")>]
static member GetInstance : string * string -> Javax.Crypto.Cipher

Parameters

transformation
String

the name of the transformation, e.g., DES/CBC/PKCS5Padding. See the Cipher section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard transformation names.

provider
String

the name of the provider.

Returns

a cipher that implements the requested transformation.

Attributes

Exceptions

if the specified provider can not provide the transformation, or it is null, empty or in an invalid format.

if no provider with the specified name can be found.

if the requested padding scheme in the transformation is not available.

if the specified provider is null.

Remarks

Returns a Cipher object that implements the specified transformation.

A new Cipher object encapsulating the CipherSpi 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 javax.crypto.Cipher.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.

Applies to