Serializable
, Key
, SecretKey
, Destroyable
public final class EncryptionKey extends Object implements SecretKey
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 an
EncryptionKey
is defined as the value of the keyValue
above.Constructor | Description |
---|---|
EncryptionKey |
Constructs an EncryptionKey from the given bytes and the key type. |
Modifier and Type | Method | Description |
---|---|---|
void |
destroy() |
Destroys this key by clearing out the key material of this key. |
boolean |
equals |
Compares the specified object with this key for equality. |
String |
getAlgorithm() |
Returns the standard algorithm name for this key. |
byte[] |
getEncoded() |
Returns the key material of this key. |
String |
getFormat() |
Returns the name of the encoding format for this key. |
int |
getKeyType() |
Returns the key type for this key. |
int |
hashCode() |
Returns a hash code for this EncryptionKey . |
String |
toString() |
Returns an informative textual representation of this EncryptionKey . |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isDestroyed
public EncryptionKey(byte[] keyBytes, int keyType)
EncryptionKey
from 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.
keyBytes
- the key material for the keykeyType
- the key type for the key as defined by the Kerberos protocol specification.NullPointerException
- if keyBytes is nullpublic int getKeyType()
IllegalStateException
- if the key is destroyedpublic String getAlgorithm()
This method can return the following value not defined on the IANA page:
getAlgorithm
in interface Key
IllegalStateException
- if the key is destroyedpublic String getFormat()
getFormat
in interface Key
IllegalStateException
- if the key is destroyedpublic byte[] getEncoded()
getEncoded
in interface Key
IllegalStateException
- if the key is destroyedpublic void destroy() throws DestroyFailedException
destroy
in interface Destroyable
DestroyFailedException
- if some error occurs while destroying this key.public String toString()
EncryptionKey
.public int hashCode()
EncryptionKey
.public boolean equals(Object other)
EncryptionKey
and the two EncryptionKey
instances are equivalent. More formally two EncryptionKey
instances are equal if they have equal key types and key material. A destroyed EncryptionKey
object is only equal to itself.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.security.jgss/javax/security/auth/kerberos/EncryptionKey.html