| |
|
| java.lang.Object javax.security.auth.kerberos.KerberosKey
KerberosKey | public class KerberosKey implements SecretKey,Destroyable(Code) | | 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
javax.security.auth.Subject Subject during the commit phase of the
authentication process.
It might be necessary for the application to be granted a
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
javax.security.auth.kerberos.ServicePermission ServicePermission .
author: Mayank Upadhyay version: 1.27, 05/05/07 since: 1.4 |
Constructor Summary | |
public | 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. | public | KerberosKey(KerberosPrincipal principal, char[] password, String algorithm) Constructs a KerberosKey from a principal's password.
Parameters: principal - the principal that this password belongs to Parameters: password - the password that should be used to compute the key Parameters: algorithm - the name for the algorithm that this key will beused for. |
Method Summary | |
public void | destroy() Destroys this key. | public boolean | equals(Object other) Compares the specified Object with this KerberosKey for equality.
Returns true if the given object is also a
KerberosKey and the two
KerberosKey instances are equivalent. | final public String | getAlgorithm() Returns the standard algorithm name for this key. | final public byte[] | getEncoded() Returns the key material of this secret key. | final public String | getFormat() Returns the name of the encoding format for this secret key. | final public int | getKeyType() Returns the key type for this long-term key. | final public KerberosPrincipal | getPrincipal() Returns the principal that this key belongs to. | final public int | getVersionNumber() Returns the key version number. | public int | hashCode() Returns a hashcode for this KerberosKey. | public boolean | isDestroyed() Determines if this key has been destroyed. | public String | toString() |
KerberosKey | public KerberosKey(KerberosPrincipal principal, byte[] keyBytes, int keyType, int versionNum)(Code) | | Constructs a KerberosKey from the given bytes when the key type and
key version number are known. This can be used when reading the secret
key information from a Kerberos "keytab".
Parameters: principal - the principal that this secret key belongs to Parameters: keyBytes - the raw bytes for the secret key Parameters: keyType - the key type for the secret key as defined by theKerberos protocol specification. Parameters: versionNum - the version number of this secret key |
KerberosKey | public KerberosKey(KerberosPrincipal principal, char[] password, String algorithm)(Code) | | Constructs a KerberosKey from a principal's password.
Parameters: principal - the principal that this password belongs to Parameters: password - the password that should be used to compute the key Parameters: algorithm - the name for the algorithm that this key will beused for. This parameter may be null in which case the defaultalgorithm "DES" will be assumed. throws: IllegalArgumentException - if the name of the algorithm passed is unsupported. |
destroy | public void destroy() throws DestroyFailedException(Code) | | Destroys this key. A call to any of its other methods after this
will cause an IllegalStateException to be thrown.
throws: DestroyFailedException - if some error occurs while destorying this key. |
equals | public boolean equals(Object other)(Code) | | Compares the specified Object with this KerberosKey for equality.
Returns true if the given object is also a
KerberosKey and the two
KerberosKey instances are equivalent.
Parameters: other - the Object to compare to true if the specified object is equal to this KerberosKey,false otherwise. NOTE: Returns false if either of the KerberosKeyobjects has been destroyed. since: 1.6 |
getEncoded | final public byte[] getEncoded()(Code) | | Returns the key material of this secret key.
the key material |
getFormat | final public String getFormat()(Code) | | Returns the name of the encoding format for this secret key.
the String "RAW" |
getKeyType | final public int getKeyType()(Code) | | Returns the key type for this long-term key.
the key type. |
getPrincipal | final public KerberosPrincipal getPrincipal()(Code) | | Returns the principal that this key belongs to.
the principal this key belongs to. |
getVersionNumber | final public int getVersionNumber()(Code) | | Returns the key version number.
the key version number. |
hashCode | public int hashCode()(Code) | | Returns a hashcode for this KerberosKey.
a hashCode() for the KerberosKey since: 1.6 |
isDestroyed | public boolean isDestroyed()(Code) | | Determines if this key has been destroyed.
|
|
|
|