다음을 통해 공유


IKey Interface

Definition

The Key interface is the top-level interface for all keys.

[Android.Runtime.Register("java/security/Key", "", "Java.Security.IKeyInvoker")]
public interface IKey : IDisposable, Java.Interop.IJavaPeerable, Java.IO.ISerializable
[<Android.Runtime.Register("java/security/Key", "", "Java.Security.IKeyInvoker")>]
type IKey = interface
    interface ISerializable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Derived
Attributes
Implements

Remarks

The Key interface is the top-level interface for all keys. It defines the functionality shared by all key objects. All keys have three characteristics:

<UL>

<LI>An Algorithm

This is the key algorithm for that key. The key algorithm is usually an encryption or asymmetric operation algorithm (such as DSA or RSA), which will work with those algorithms and with related algorithms (such as MD5 with RSA, SHA-1 with RSA, Raw DSA, etc.) The name of the algorithm of a key is obtained using the #getAlgorithm() getAlgorithm method.

<LI>An Encoded Form

This is an external encoded form for the key used when a standard representation of the key is needed outside the Java Virtual Machine, as when transmitting the key to some other party. The key is encoded according to a standard format (such as X.509 SubjectPublicKeyInfo or PKCS#8), and is returned using the #getEncoded() getEncoded method. Note: The syntax of the ASN.1 type SubjectPublicKeyInfo is defined as follows:

SubjectPublicKeyInfo ::= SEQUENCE {
              algorithm AlgorithmIdentifier,
              subjectPublicKey BIT STRING }

            AlgorithmIdentifier ::= SEQUENCE {
              algorithm OBJECT IDENTIFIER,
              parameters ANY DEFINED BY algorithm OPTIONAL }

For more information, see RFC 5280: Internet X.509 Public Key Infrastructure Certificate and CRL Profile.

<LI>A Format

This is the name of the format of the encoded key. It is returned by the #getFormat() getFormat method.

</UL>

Keys are generally obtained through key generators, certificates, key stores or other classes used to manage keys. Keys may also be obtained from key specifications (transparent representations of the underlying key material) through the use of a key factory (see KeyFactory).

A Key should use KeyRep as its serialized representation. Note that a serialized Key may contain sensitive information which should not be exposed in untrusted environments. See the Security Appendix of the Serialization Specification for more information.

Added in 1.1.

Java documentation for java.security.Key.

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.

Fields

SerialVersionUID

The class fingerprint that is set to indicate serialization compatibility with a previous version of the class.

Properties

Algorithm

Returns the name of the algorithm of this key.

Format

Returns the name of the format used to encode this key, or null if it can not be encoded.

Handle

Gets the JNI value of the underlying Android object.

(Inherited from IJavaObject)
JniIdentityHashCode

Returns the value of java.lang.System.identityHashCode() for the wrapped instance.

(Inherited from IJavaPeerable)
JniManagedPeerState

State of the managed peer.

(Inherited from IJavaPeerable)
JniPeerMembers

Member access and invocation support.

(Inherited from IJavaPeerable)
PeerReference

Returns a JniObjectReference of the wrapped Java object instance.

(Inherited from IJavaPeerable)

Methods

Disposed()

Called when the instance has been disposed.

(Inherited from IJavaPeerable)
DisposeUnlessReferenced()

If there are no outstanding references to this instance, then calls Dispose(); otherwise, does nothing.

(Inherited from IJavaPeerable)
Finalized()

Called when the instance has been finalized.

(Inherited from IJavaPeerable)
GetEncoded()

Returns the key in its primary encoding format, or null if this key does not support encoding.

SetJniIdentityHashCode(Int32)

Set the value returned by JniIdentityHashCode.

(Inherited from IJavaPeerable)
SetJniManagedPeerState(JniManagedPeerStates) (Inherited from IJavaPeerable)
SetPeerReference(JniObjectReference)

Set the value returned by PeerReference.

(Inherited from IJavaPeerable)
UnregisterFromRuntime()

Unregister this instance so that the runtime will not return it from future Java.Interop.JniRuntime+JniValueManager.PeekValue invocations.

(Inherited from IJavaPeerable)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to