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 and Description |
|---|
EncryptionKey(byte[] keyBytes,
int keyType)
Constructs a
EncryptionKey from the given bytes and
the key type. |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroys this key by clearing out the key material of this key.
|
boolean |
equals(Object other)
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. |
boolean |
isDestroyed()
Determine if this
Object has been destroyed. |
String |
toString()
Returns an informative textual representation of this
EncryptionKey. |
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 KeyIllegalStateException - if the key is destroyedpublic String getFormat()
getFormat in interface KeyIllegalStateException - if the key is destroyedpublic byte[] getEncoded()
getEncoded in interface KeyIllegalStateException - if the key is destroyedpublic void destroy()
throws DestroyFailedException
destroy in interface DestroyableDestroyFailedException - if some error occurs while destorying
this key.public boolean isDestroyed()
DestroyableObject has been destroyed.isDestroyed in interface DestroyableObject has been destroyed,
false otherwise.public String toString()
EncryptionKey.public int hashCode()
EncryptionKey.hashCode in class ObjectEncryptionKey.Object.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)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.equals in class Objectother - the object to compare toEncryptionKey, false otherwise.Object.hashCode(),
HashMap Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2016, Oracle and/or its affiliates. All rights reserved.
DRAFT 9-internal+0-2016-01-26-133437.ivan.openjdk9onspinwait