- java.lang.Object
- 
- javax.security.auth.kerberos.EncryptionKey
 
- 
- All Implemented Interfaces:
- Serializable,- Key,- SecretKey,- Destroyable
 
 public final class EncryptionKey extends Object implements SecretKey This class encapsulates an EncryptionKey used in Kerberos.An EncryptionKey is defined in Section 4.2.9 of the Kerberos Protocol Specification (RFC 4120) as: EncryptionKey ::= SEQUENCE { keytype [0] Int32 -- actually encryption type --, keyvalue [1] OCTET STRING }The key material of anEncryptionKeyis defined as the value of thekeyValueabove.- Since:
- 9
- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description EncryptionKey(byte[] keyBytes, int keyType)Constructs anEncryptionKeyfrom the given bytes and the key type.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Destroys this key by clearing out the key material of this key.booleanequals(Object other)Compares the specified object with this key for equality.StringgetAlgorithm()Returns the standard algorithm name for this key.byte[]getEncoded()Returns the key material of this key.StringgetFormat()Returns the name of the encoding format for this key.intgetKeyType()Returns the key type for this key.inthashCode()Returns a hash code for thisEncryptionKey.StringtoString()Returns an informative textual representation of thisEncryptionKey.- 
Methods declared in class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods declared in interface javax.security.auth.DestroyableisDestroyed
 
- 
 
- 
- 
- 
Constructor Detail- 
EncryptionKeypublic EncryptionKey(byte[] keyBytes, int keyType)Constructs anEncryptionKeyfrom the given bytes and the key type.The contents of the byte array are copied; subsequent modification of the byte array does not affect the newly created key. - Parameters:
- keyBytes- the key material for the key
- keyType- the key type for the key as defined by the Kerberos protocol specification.
- Throws:
- NullPointerException- if keyBytes is null
 
 
- 
 - 
Method Detail- 
getKeyTypepublic int getKeyType() Returns the key type for this key.- Returns:
- the key type.
- Throws:
- IllegalStateException- if the key is destroyed
 
 - 
getAlgorithmpublic String getAlgorithm() Returns the standard algorithm name for this key. The algorithm names are the encryption type string defined on the IANA Kerberos Encryption Type Numbers page.This method can return the following value not defined on the IANA page: - none: for etype equal to 0
- unknown: for etype greater than 0 but unsupported by the implementation
- private: for etype smaller than 0
 - Specified by:
- getAlgorithmin interface- Key
- Returns:
- the name of the algorithm associated with this key.
- Throws:
- IllegalStateException- if the key is destroyed
 
 - 
getFormatpublic String getFormat() Returns the name of the encoding format for this key.- Specified by:
- getFormatin interface- Key
- Returns:
- the String "RAW"
- Throws:
- IllegalStateException- if the key is destroyed
 
 - 
getEncodedpublic byte[] getEncoded() Returns the key material of this key.- Specified by:
- getEncodedin interface- Key
- Returns:
- a newly allocated byte array that contains the key material
- Throws:
- IllegalStateException- if the key is destroyed
 
 - 
destroypublic void destroy() throws DestroyFailedExceptionDestroys this key by clearing out the key material of this key.- Specified by:
- destroyin interface- Destroyable
- Throws:
- DestroyFailedException- if some error occurs while destroying this key.
 
 - 
toStringpublic String toString() Returns an informative textual representation of thisEncryptionKey.
 - 
hashCodepublic int hashCode() Returns a hash code for thisEncryptionKey.- Overrides:
- hashCodein class- Object
- Returns:
- a hash code for this EncryptionKey.
- See Also:
- Object.equals(java.lang.Object),- System.identityHashCode(java.lang.Object)
 
 - 
equalspublic boolean equals(Object other) Compares the specified object with this key for equality. Returns true if the given object is also anEncryptionKeyand the twoEncryptionKeyinstances are equivalent. More formally twoEncryptionKeyinstances are equal if they have equal key types and key material. A destroyedEncryptionKeyobject is only equal to itself.- Overrides:
- equalsin class- Object
- Parameters:
- other- the object to compare to
- Returns:
- true if the specified object is equal to this
 EncryptionKey, false otherwise.
- See Also:
- Object.hashCode(),- HashMap
 
 
- 
 
-