public class Keytab
extends java.lang.Object
{
version : 2 bytes (0x05 0x02)
keytabEntry*
}
keytab_entry
{
size : int
numComponents : short
realm : countedOctetString
components[numComponents] : countedOctetString
nameType : int
timestamp : int
vno8 : byte
key : keyBlock
vno : int // only present if >= 4 bytes left in entry
};
keyblock
{
type : int
data : countedOctetString
}
countedOctetString
{
length : short
data[length] : bytes
}| Modifier and Type | Field and Description |
|---|---|
private java.util.List<KeytabEntry> |
entries |
private byte[] |
keytabVersion |
static short |
VERSION_0X501 |
static byte[] |
VERSION_0X501_BYTES
Byte array constant for keytab file format 5.1.
|
static short |
VERSION_0X502 |
static byte[] |
VERSION_0X502_BYTES
Byte array constant for keytab file format 5.2.
|
| Constructor and Description |
|---|
Keytab() |
| Modifier and Type | Method and Description |
|---|---|
protected static byte[] |
getBytesFromFile(java.io.File file)
Returns the contents of the
File in a byte array. |
java.util.List<KeytabEntry> |
getEntries() |
static Keytab |
getInstance()
Returns a new instance of a keytab with the version
defaulted to 5.2.
|
byte[] |
getKeytabVersion() |
(package private) static Keytab |
read(byte[] bytes)
Read bytes into a keytab.
|
static Keytab |
read(java.io.File file)
Read a keytab file.
|
private static Keytab |
readKeytab(java.nio.ByteBuffer buffer)
Read the contents of the buffer into a keytab.
|
void |
setEntries(java.util.List<KeytabEntry> entries) |
void |
setKeytabVersion(byte[] keytabVersion) |
(package private) java.nio.ByteBuffer |
write()
Write the keytab to a
ByteBuffer. |
void |
write(java.io.File file)
Write the keytab to a
File. |
protected void |
writeFile(java.nio.ByteBuffer buffer,
java.io.File file)
Write the contents of the
ByteBuffer to a File. |
public static final byte[] VERSION_0X501_BYTES
public static final short VERSION_0X501
public static final byte[] VERSION_0X502_BYTES
public static final short VERSION_0X502
private byte[] keytabVersion
private java.util.List<KeytabEntry> entries
public static Keytab read(java.io.File file) throws java.io.IOException
file - java.io.IOExceptionpublic static Keytab getInstance()
public void write(java.io.File file)
throws java.io.IOException
File.file - java.io.IOExceptionpublic void setEntries(java.util.List<KeytabEntry> entries)
entries - The entries to set.public void setKeytabVersion(byte[] keytabVersion)
keytabVersion - The keytabVersion to set.public java.util.List<KeytabEntry> getEntries()
public byte[] getKeytabVersion()
static Keytab read(byte[] bytes)
bytes - java.nio.ByteBuffer write()
ByteBuffer.private static Keytab readKeytab(java.nio.ByteBuffer buffer)
buffer - protected static byte[] getBytesFromFile(java.io.File file)
throws java.io.IOException
File in a byte array.file - java.io.IOExceptionprotected void writeFile(java.nio.ByteBuffer buffer,
java.io.File file)
throws java.io.IOException
ByteBuffer to a File.buffer - file - java.io.IOException