public class Keytab extends 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 |
|---|---|
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(File file)
Returns the contents of the
File in a byte array. |
List<KeytabEntry> |
getEntries() |
static Keytab |
getInstance()
Returns a new instance of a keytab with the version
defaulted to 5.2.
|
byte[] |
getKeytabVersion() |
static Keytab |
read(File file)
Read a keytab file.
|
void |
setEntries(List<KeytabEntry> entries) |
void |
setKeytabVersion(byte[] keytabVersion) |
void |
write(File file)
Write the keytab to a
File. |
protected void |
writeFile(ByteBuffer buffer,
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
public static Keytab read(File file) throws IOException
file - IOExceptionpublic static Keytab getInstance()
public void write(File file) throws IOException
File.file - IOExceptionpublic void setEntries(List<KeytabEntry> entries)
entries - The entries to set.public void setKeytabVersion(byte[] keytabVersion)
keytabVersion - The keytabVersion to set.public List<KeytabEntry> getEntries()
public byte[] getKeytabVersion()
protected static byte[] getBytesFromFile(File file) throws IOException
File in a byte array.file - IOExceptionprotected void writeFile(ByteBuffer buffer, File file) throws IOException
ByteBuffer to a File.buffer - file - IOExceptionCopyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.