sun.security.mule.krb5.internal.ktab
Class KeyTab

java.lang.Object
  extended by sun.security.mule.krb5.internal.ktab.KeyTab
All Implemented Interfaces:
KeyTabConstants

public class KeyTab
extends Object
implements KeyTabConstants

This class represents key table. The key table functions deal with storing and retrieving service keys for use in authentication exchanges.

Author:
Yanni Zhang

Field Summary
 
Fields inherited from interface sun.security.mule.krb5.internal.ktab.KeyTabConstants
keySize, keyTypeSize, keyVersionSize, KRB5_KT_VNO, KRB5_KT_VNO_1, principalComponentSize, principalSize, principalTypeSize, realmSize, timestampSize
 
Method Summary
 void addEntry(PrincipalName service, char[] psswd, Config kerberosConfig)
          Adds a new entry in the key table.
static KeyTab create(Config kerberosConfig)
          Creates a new default key table.
static KeyTab create(String name, Config kerberosConfig)
          Creates a new default key table.
 void createVersion(File file)
          Creates key table file version.
 void deleteEntry(PrincipalName service)
          Removes an entry from the key table.
 boolean findServiceEntry(PrincipalName service)
          Searches for the service entry in the keytab file.
 KeyTabEntry[] getEntries()
          Gets the list of service entries in key table.
static KeyTab getInstance(Config kerberosConfig)
          Gets the single instance of KeyTab class.
static KeyTab getInstance(File file, Config kerberosConfig)
          Gets the single instance of KeyTab class.
static KeyTab getInstance(String s, Config kerberosConfig)
           
 EncryptionKey readServiceKey(PrincipalName service)
          Reads the service key from the keytab file.
 EncryptionKey[] readServiceKeys(PrincipalName service, Config kerberosConfig)
          Reads all keys for a service from the keytab file that have etypes that have been configured for use.
static void refresh()
           
 void save()
          Saves the file at the directory.
static String tabName()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static KeyTab getInstance(String s,
                                 Config kerberosConfig)

getInstance

public static KeyTab getInstance(File file,
                                 Config kerberosConfig)
Gets the single instance of KeyTab class.

Parameters:
file - the key tab file.
Returns:
single instance of KeyTab; return null if error occurs while reading data out of the file.

getInstance

public static KeyTab getInstance(Config kerberosConfig)
Gets the single instance of KeyTab class.

Returns:
single instance of KeyTab; return null if default keytab file does not exist, or error occurs while reading data from the file.

readServiceKey

public EncryptionKey readServiceKey(PrincipalName service)
Reads the service key from the keytab file.

Parameters:
service - the PrincipalName of the requested service.
Returns:
the last service key in the keytab

readServiceKeys

public EncryptionKey[] readServiceKeys(PrincipalName service,
                                       Config kerberosConfig)
Reads all keys for a service from the keytab file that have etypes that have been configured for use.

Parameters:
service - the PrincipalName of the requested service
Returns:
an array containing all the service keys

findServiceEntry

public boolean findServiceEntry(PrincipalName service)
Searches for the service entry in the keytab file. The etype of the key must be one that has been configured to be used.

Parameters:
service - the PrincipalName of the requested service.
Returns:
true if the entry is found, otherwise, return false.

tabName

public static String tabName()

addEntry

public void addEntry(PrincipalName service,
                     char[] psswd,
                     Config kerberosConfig)
              throws KrbException
Adds a new entry in the key table.

Parameters:
service - the service which will have a new entry in the key table.
psswd - the password which generates the key.
Throws:
KrbException

getEntries

public KeyTabEntry[] getEntries()
Gets the list of service entries in key table.

Returns:
array of KeyTabEntry.

create

public static KeyTab create(Config kerberosConfig)
                     throws IOException,
                            RealmException
Creates a new default key table.

Throws:
IOException
RealmException

create

public static KeyTab create(String name,
                            Config kerberosConfig)
                     throws IOException,
                            RealmException
Creates a new default key table.

Throws:
IOException
RealmException

save

public void save()
          throws IOException
Saves the file at the directory.

Throws:
IOException

deleteEntry

public void deleteEntry(PrincipalName service)
Removes an entry from the key table.

Parameters:
service - the service PrincipalName.

createVersion

public void createVersion(File file)
                   throws IOException
Creates key table file version.

Parameters:
file - the key table file.
Throws:
IOException.
IOException

refresh

public static void refresh()


Copyright © 2013. All Rights Reserved.