Methods Summary |
---|
public void | destroy()Destroys this key. A call to any of its other methods after this
will cause an IllegalStateException to be thrown.
if (!destroyed) {
key.destroy();
principal = null;
destroyed = true;
}
|
public boolean | equals(java.lang.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.
if (other == this)
return true;
if (! (other instanceof KerberosKey)) {
return false;
}
KerberosKey otherKey = ((KerberosKey) other);
if (isDestroyed() || otherKey.isDestroyed()) {
return false;
}
if (versionNum != otherKey.getVersionNumber() ||
getKeyType() != otherKey.getKeyType() ||
!Arrays.equals(getEncoded(), otherKey.getEncoded())) {
return false;
}
if (principal == null) {
if (otherKey.getPrincipal() != null) {
return false;
}
} else {
if (!principal.equals(otherKey.getPrincipal())) {
return false;
}
}
return true;
|
public final java.lang.String | getAlgorithm()Returns the standard algorithm name for this key. For
example, "DES" would indicate that this key is a DES key.
See Appendix A in the
Java Cryptography Architecture API Specification & Reference
for information about standard algorithm names.
if (destroyed)
throw new IllegalStateException("This key is no longer valid");
return key.getAlgorithm();
|
public final byte[] | getEncoded()Returns the key material of this secret key.
if (destroyed)
throw new IllegalStateException("This key is no longer valid");
return key.getEncoded();
|
public final java.lang.String | getFormat()Returns the name of the encoding format for this secret key.
if (destroyed)
throw new IllegalStateException("This key is no longer valid");
return key.getFormat();
|
public final int | getKeyType()Returns the key type for this long-term key.
if (destroyed)
throw new IllegalStateException("This key is no longer valid");
return key.getKeyType();
|
public final javax.security.auth.kerberos.KerberosPrincipal | getPrincipal()Returns the principal that this key belongs to.
if (destroyed)
throw new IllegalStateException("This key is no longer valid");
return principal;
|
public final int | getVersionNumber()Returns the key version number.
if (destroyed)
throw new IllegalStateException("This key is no longer valid");
return versionNum;
|
public int | hashCode()Returns a hashcode for this KerberosKey.
int result = 17;
if (isDestroyed()) {
return result;
}
result = 37 * result + Arrays.hashCode(getEncoded());
result = 37 * result + getKeyType();
if (principal != null) {
result = 37 * result + principal.hashCode();
}
return result * 37 + versionNum;
|
public boolean | isDestroyed()Determines if this key has been destroyed.
return destroyed;
|
public java.lang.String | toString()
if (destroyed) {
return "Destroyed Principal";
}
return "Kerberos Principal " + principal.toString() +
"Key Version " + versionNum +
"key " + key.toString();
|