Oracle Security Developer Tools Crypto Java API Reference
10g Release 2 (10.1.2.0.2)

B15565-01


oracle.security.crypto.core
Interface Key

All Superinterfaces:
java.lang.Cloneable
All Known Subinterfaces:
PrivateKey, PublicKey
All Known Implementing Classes:
DHKey, DHPrivateKey, DHPublicKey, DSAPrivateKey, DSAPublicKey, PrivateKeyPKCS8, RSAKey, RSAPrivateKey, RSAPublicKey, SymmetricKey

public interface Key
extends java.lang.Cloneable

An interface for a key, which may be used for encryption or decryption, for generating or verifying signatures, or for generating or verifying MACs.

A key may be a private key, a public key, or a symmetric key.

The code using this API is responsible for erasing any keys it has to when it is done with them to prevent leakage of sensitive key material.

See Also:
PrivateKey, PublicKey, SymmetricKey

Method Summary
 java.lang.Object clone()
          Performs a deep clone of the Key instance.
 void erase()
          Erases the key material, making the key un-usable.
 java.lang.String getAlgorithm()
          Returns the algorithm for which this key is primarily used.
 int getBitLength()
          Returns the number of bits required to represent this key's defining key material
 byte[] getEncoded()
          Returns the encoded form of this key.
 java.lang.String getFormat()
          Returns the format of this key's encoded form.

 

Method Detail

getAlgorithm

public java.lang.String getAlgorithm()
Returns the algorithm for which this key is primarily used.

getFormat

public java.lang.String getFormat()
Returns the format of this key's encoded form.

getEncoded

public byte[] getEncoded()
Returns the encoded form of this key.

getBitLength

public int getBitLength()
Returns the number of bits required to represent this key's defining key material

i.e. In the case of an RSA key, the modulus' bit length would be returned .


erase

public void erase()
Erases the key material, making the key un-usable.

Keys can be erased multiple times with no consequence.


clone

public java.lang.Object clone()
Performs a deep clone of the Key instance.
Returns:
a deep clone of the Key instance.

Oracle Security Developer Tools Crypto Java API Reference
10g Release 2 (10.1.2.0.2)

B15565-01


Copyright © 2005 , Oracle. All rights reserved.