Methods Summary |
---|
public void | destroy()
if (!destroyed) {
Arrays.fill(keyBytes, (byte) 0);
destroyed = true;
}
|
public final java.lang.String | getAlgorithm()
return getAlgorithmName(keyType);
|
private java.lang.String | getAlgorithmName(int eType)
if (destroyed)
throw new IllegalStateException("This key is no longer valid");
switch (eType) {
case EncryptedData.ETYPE_DES_CBC_CRC:
case EncryptedData.ETYPE_DES_CBC_MD5:
return "DES";
case EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD:
return "DESede";
case EncryptedData.ETYPE_NULL:
return "NULL";
default:
throw new IllegalArgumentException(
"Unsupported encryption type: " + eType);
}
|
public final byte[] | getEncoded()
if (destroyed)
throw new IllegalStateException("This key is no longer valid");
return (byte[])keyBytes.clone();
|
public final java.lang.String | getFormat()
if (destroyed)
throw new IllegalStateException("This key is no longer valid");
return "RAW";
|
public final int | getKeyType()Returns the keyType for this key as defined in the Kerberos Spec.
if (destroyed)
throw new IllegalStateException("This key is no longer valid");
return keyType;
|
public boolean | isDestroyed()
return destroyed;
|
private synchronized void | readObject(java.io.ObjectInputStream ois)
try {
EncryptionKey encKey = new EncryptionKey(new
DerValue((byte[])ois.readObject()));
keyType = encKey.getEType();
keyBytes = encKey.getBytes();
} catch (Asn1Exception ae) {
throw new IOException (ae.getMessage());
}
|
public java.lang.String | toString()
HexDumpEncoder hd = new HexDumpEncoder();
return new String("EncryptionKey: keyType=" + keyType
+ " keyBytes (hex dump)="
+ (keyBytes == null || keyBytes.length == 0 ?
" Empty Key" :
'\n" + hd.encode(keyBytes)
+ '\n"));
|
private synchronized void | writeObject(java.io.ObjectOutputStream ois)
if (destroyed) {
throw new IOException ("This key is no longer valid");
}
try {
ois.writeObject((new EncryptionKey(keyType,keyBytes)).asn1Encode());
} catch (Asn1Exception ae) {
throw new IOException(ae.getMessage());
}
|