| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public class KerberosKey extends Object implements SecretKey, Destroyable
This class encapsulates a long term secret key for a Kerberos principal.
All Kerberos JAAS login modules that obtain a principal's password and generate the secret key from it should use this class. Where available, the login module might even read this secret key directly from a Kerberos "keytab". Sometimes, such as when authenticating a server in the absence of user-to-user authentication, the login module will store an instance of this class in the private credential set of a {@link javax.security.auth.Subject Subject} during the commit phase of the authentication process.
It might be necessary for the application to be granted a {@link javax.security.auth.PrivateCredentialPermission PrivateCredentialPermission} if it needs to access the KerberosKey instance from a Subject. This permission is not needed when the application depends on the default JGSS Kerberos mechanism to access the KerberosKey. In that case, however, the application will need an appropriate {@link javax.security.auth.kerberos.ServicePermission ServicePermission}.
Constructor Summary | |
---|---|
KerberosKey(KerberosPrincipal principal, byte[] keyBytes, int keyType, int versionNum) Constructs a KerberosKey from the given bytes when the key type and key version number are known. |
|
KerberosKey(KerberosPrincipal principal, char[] password, String algorithm) Constructs a KerberosKey from a principal's password. |
Method Summary | |
---|---|
void |
destroy() Destroys this key. |
boolean |
Compares the specified Object with this KerberosKey for equality. |
String |
Returns the standard algorithm name for this key. |
byte[] |
Returns the key material of this secret key. |
String |
Returns the name of the encoding format for this secret key. |
int |
Returns the key type for this long-term key. |
KerberosPrincipal |
Returns the principal that this key belongs to. |
int |
Returns the key version number. |
int |
hashCode() Returns a hashcode for this KerberosKey. |
boolean |
Determines if this key has been destroyed. |
String |
toString() Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KerberosKey(KerberosPrincipal principal, byte[] keyBytes, int keyType, int versionNum)
principal
- the principal that this secret key belongs tokeyBytes
- the raw bytes for the secret keykeyType
- the key type for the secret key as defined by the
Kerberos protocol specification.versionNum
- the version number of this secret keypublic KerberosKey(KerberosPrincipal principal, char[] password, String algorithm)
principal
- the principal that this password belongs topassword
- the password that should be used to compute the keyalgorithm
- the name for the algorithm that this key will be
used for. This parameter may be null in which case the default
algorithm "DES" will be assumed.Method Detail |
---|
public void destroy() throws DestroyFailedException
DestroyFailedException
- if some error occurs while destorying
this key.public boolean equals(Object other)
KerberosKey
and the two
KerberosKey
instances are equivalent.
equals
in class Object
other
- the Object to compare topublic final String getAlgorithm()
public final byte[] getEncoded()
public final String getFormat()
public final int getKeyType()
public final KerberosPrincipal getPrincipal()
public final int getVersionNumber()
public int hashCode()
hashCode
in class Object
KerberosKey
public boolean isDestroyed()
public String toString()
toString
in class Object
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |