SecretKeyFactory Class

Definition

This class represents a factory for secret keys.

[Android.Runtime.Register("javax/crypto/SecretKeyFactory", DoNotGenerateAcw=true)]
public class SecretKeyFactory : Java.Lang.Object
[<Android.Runtime.Register("javax/crypto/SecretKeyFactory", DoNotGenerateAcw=true)>]
type SecretKeyFactory = class
    inherit Object
Inheritance
SecretKeyFactory
Attributes

Remarks

This class represents a factory for secret keys.

Key factories are used to convert keys (opaque cryptographic keys of type Key) into key specifications (transparent representations of the underlying key material), and vice versa. Secret key factories operate only on secret (symmetric) keys.

Key factories are bi-directional, i.e., they allow to build an opaque key object from a given key specification (key material), or to retrieve the underlying key material of a key object in a suitable format.

Application developers should refer to their provider's documentation to find out which key specifications are supported by the #generateSecret(java.security.spec.KeySpec) generateSecret and #getKeySpec(javax.crypto.SecretKey, java.lang.Class) getKeySpec methods. For example, the DES secret-key factory supplied by the "SunJCE" provider supports DESKeySpec as a transparent representation of DES keys, and that provider's secret-key factory for Triple DES keys supports DESedeKeySpec as a transparent representation of Triple DES keys.

Android provides the following SecretKeyFactory algorithms: <table> <thead> <tr> <th>Algorithm</th> <th>Supported API Levels</th> </tr> </thead> <tbody> <tr> <td>AES</td> <td>23+</td> </tr> <tr> <td>DES</td> <td>1+</td> </tr> <tr> <td>DESede</td> <td>1+</td> </tr> <tr> <td>HmacSHA1</td> <td>23+</td> </tr> <tr> <td>HmacSHA224</td> <td>23+</td> </tr> <tr> <td>HmacSHA256</td> <td>23+</td> </tr> <tr> <td>HmacSHA384</td> <td>23+</td> </tr> <tr> <td>HmacSHA512</td> <td>23+</td> </tr> <tr> <td>PBEwithHmacSHA1</td> <td>1+</td> </tr> <tr> <td>PBEwithHmacSHA1AndAES_128</td> <td>26+</td> </tr> <tr> <td>PBEwithHmacSHA1AndAES_256</td> <td>26+</td> </tr> <tr> <td>PBEwithHmacSHA224AndAES_128</td> <td>26+</td> </tr> <tr> <td>PBEwithHmacSHA224AndAES_256</td> <td>26+</td> </tr> <tr> <td>PBEwithHmacSHA256AndAES_128</td> <td>26+</td> </tr> <tr> <td>PBEwithHmacSHA256AndAES_256</td> <td>26+</td> </tr> <tr> <td>PBEwithHmacSHA384AndAES_128</td> <td>26+</td> </tr> <tr> <td>PBEwithHmacSHA384AndAES_256</td> <td>26+</td> </tr> <tr> <td>PBEwithHmacSHA512AndAES_128</td> <td>26+</td> </tr> <tr> <td>PBEwithHmacSHA512AndAES_256</td> <td>26+</td> </tr> <tr> <td>PBEwithMD5AND128BITAES-CBC-OPENSSL</td> <td>1+</td> </tr> <tr> <td>PBEwithMD5AND192BITAES-CBC-OPENSSL</td> <td>1+</td> </tr> <tr> <td>PBEwithMD5AND256BITAES-CBC-OPENSSL</td> <td>1+</td> </tr> <tr> <td>PBEwithMD5ANDDES</td> <td>1+</td> </tr> <tr> <td>PBEwithMD5ANDRC2</td> <td>1+</td> </tr> <tr> <td>PBEwithSHA1ANDDES</td> <td>1+</td> </tr> <tr> <td>PBEwithSHA1ANDRC2</td> <td>1+</td> </tr> <tr> <td>PBEwithSHA256AND128BITAES-CBC-BC</td> <td>1+</td> </tr> <tr> <td>PBEwithSHA256AND192BITAES-CBC-BC</td> <td>1+</td> </tr> <tr> <td>PBEwithSHA256AND256BITAES-CBC-BC</td> <td>1+</td> </tr> <tr> <td>PBEwithSHAAND128BITAES-CBC-BC</td> <td>1+</td> </tr> <tr> <td>PBEwithSHAAND128BITRC2-CBC</td> <td>10+</td> </tr> <tr> <td>PBEwithSHAAND128BITRC4</td> <td>10+</td> </tr> <tr> <td>PBEwithSHAAND192BITAES-CBC-BC</td> <td>1+</td> </tr> <tr> <td>PBEwithSHAAND2-KEYTRIPLEDES-CBC</td> <td>1+</td> </tr> <tr> <td>PBEwithSHAAND256BITAES-CBC-BC</td> <td>1+</td> </tr> <tr> <td>PBEwithSHAAND3-KEYTRIPLEDES-CBC</td> <td>1+</td> </tr> <tr> <td>PBEwithSHAAND40BITRC2-CBC</td> <td>1+</td> </tr> <tr> <td>PBEwithSHAAND40BITRC4</td> <td>10+</td> </tr> <tr> <td>PBEwithSHAANDTWOFISH-CBC</td> <td>10+</td> </tr> <tr> <td>PBKDF2withHmacSHA1</td> <td>10+</td> </tr> <tr> <td>PBKDF2withHmacSHA1And8BIT</td> <td>19+</td> </tr> <tr> <td>PBKDF2withHmacSHA224</td> <td>26+</td> </tr> <tr> <td>PBKDF2withHmacSHA256</td> <td>26+</td> </tr> <tr> <td>PBKDF2withHmacSHA384</td> <td>26+</td> </tr> <tr> <td>PBKDF2withHmacSHA512</td> <td>26+</td> </tr> </tbody> </table>

These algorithms are described in the SecretKeyFactory section of the Java Cryptography Architecture Standard Algorithm Name Documentation.

Added in 1.4.

Java documentation for javax.crypto.SecretKeyFactory.

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

SecretKeyFactory(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

SecretKeyFactory(SecretKeyFactorySpi, Provider, String)

Creates a SecretKeyFactory object.

Properties

Algorithm

Returns the algorithm name of this SecretKeyFactory object.

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
Provider

Returns the provider of this SecretKeyFactory object.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

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)
GenerateSecret(IKeySpec)

Generates a SecretKey object from the provided key specification (key material).

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetInstance(String, Provider)

Returns a SecretKeyFactory object that converts secret keys of the specified algorithm.

GetInstance(String, String)

Returns a SecretKeyFactory object that converts secret keys of the specified algorithm.

GetInstance(String)

Returns a SecretKeyFactory object that converts secret keys of the specified algorithm.

GetKeySpec(ISecretKey, Class)

Returns a specification (key material) of the given key object in the requested format.

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)
TranslateKey(ISecretKey)

Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this secret-key factory.

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, 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)
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)

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