public class KerberosKey extends Object implements Serializable, SecretKey, Destroyable
Constructor and Description |
---|
KerberosKey(KerberosPrincipal principal,
byte[] key,
int type,
int version)
Construct a new key with the indicated principal and key.
|
KerberosKey(KerberosPrincipal principal,
char[] passwd,
String algo)
Construct a new key with the indicated principal and a password.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy this key.
|
String |
getAlgorithm()
Return the name of the algorithm used to create this key.
|
byte[] |
getEncoded()
Return the encoded form of this key.
|
String |
getFormat()
Return the format of this key.
|
int |
getKeyType()
Return the type of this key.
|
KerberosPrincipal |
getPrincipal()
Return the principal associated with this key.
|
int |
getVersionNumber()
Return the version number of this key.
|
boolean |
isDestroyed()
Return true if this key has been destroyed.
|
String |
toString()
Convert this Object to a human-readable String.
|
public KerberosKey(KerberosPrincipal principal, byte[] key, int type, int version)
principal
- the principalkey
- the key's datatype
- the key's typeversion
- the key's version numberpublic KerberosKey(KerberosPrincipal principal, char[] passwd, String algo) throws NotImplementedException
principal
- the principalpasswd
- the password to usealgo
- the algorithm; if null the "DES" algorithm is usedNotImplementedException
public final String getAlgorithm()
getAlgorithm
in interface Key
public final String getFormat()
public final KerberosPrincipal getPrincipal()
public final int getKeyType()
public final int getVersionNumber()
public final byte[] getEncoded()
getEncoded
in interface Key
public void destroy() throws DestroyFailedException
destroy
in interface Destroyable
DestroyFailedException
- If this object could not be
destroyed.public boolean isDestroyed()
isDestroyed
in interface Destroyable
public String toString()
Object
System.out.println()
and such.
It is typical, but not required, to ensure that this method
never completes abruptly with a RuntimeException
.
This method will be called when performing string
concatenation with this object. If the result is
null
, string concatenation will instead
use "null"
.
The default implementation returns
getClass().getName() + "@" +
Integer.toHexString(hashCode())
.
toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)