APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.jgss.krb5

public final Class Krb5MechFactory

extends Object
implements MechanismFactory
Class Inheritance
All Implemented Interfaces
sun.security.jgss.spi.MechanismFactory
Imports
org.ietf.jgss.*, sun.security.jgss.GSSUtil, .GSSCaller, sun.security.jgss.spi.*, java.security.Provider, java.util.Vector

Krb5 Mechanism plug in for JGSS This is the properties object required by the JGSS framework. All mechanism specific information is defined here.
Author
Mayank Upadhyay

Field Summary

Modifier and TypeField and Description
private final GSSCaller
pack-priv static final Oid
private static final Oid[]
pack-priv static final Oid
pack-priv static final Provider

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
private static Oid
createOid(String oidStr)

public GSSCredentialSpi
getCredentialElement(GSSNameSpi name, int initLifetime, int acceptLifetime, int usage)

Implements sun.security.jgss.spi.MechanismFactory.getCredentialElement.

Creates a credential element for this mechanism to be included as part of a GSSCredential implementation.

private static Krb5CredElement
getCredFromSubject(GSSNameSpi name, boolean initiate)

public GSSContextSpi
getMechanismContext(GSSNameSpi peer, GSSCredentialSpi myInitiatorCred, int lifetime)

Implements sun.security.jgss.spi.MechanismFactory.getMechanismContext.

Creates a security context for this mechanism so that it can be used on the context initiator's side.

public GSSContextSpi
getMechanismContext(GSSCredentialSpi myAcceptorCred)

Implements sun.security.jgss.spi.MechanismFactory.getMechanismContext.

Creates a security context for this mechanism so that it can be used on the context acceptor's side.

public GSSContextSpi
getMechanismContext(byte[] exportedContext)

Implements sun.security.jgss.spi.MechanismFactory.getMechanismContext.

Creates a security context from a previously exported (serialized) security context.

public Oid
getMechanismOid()

Implements sun.security.jgss.spi.MechanismFactory.getMechanismOid.

Returns the Oid of the mechanism that this factory supports.

public GSSNameSpi
getNameElement(String nameStr, Oid nameType)

Implements sun.security.jgss.spi.MechanismFactory.getNameElement.

Creates a name element for this mechanism to be included as part of a GSSName implementation.

public GSSNameSpi
getNameElement(byte[] name, Oid nameType)

Implements sun.security.jgss.spi.MechanismFactory.getNameElement.

This is a variation of the factory method that accepts a String for the characters that make up the name.

public Oid[]
getNameTypes()

Implements sun.security.jgss.spi.MechanismFactory.getNameTypes.

Returns the GSS-API nametypes that this mechanism can support.

public Provider
getProvider()

Implements sun.security.jgss.spi.MechanismFactory.getProvider.

Returns the provider that this factory came from.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

callerback to summary
private final GSSCaller caller
GSS_KRB5_MECH_OIDback to summary
pack-priv static final Oid GSS_KRB5_MECH_OID
nameTypesback to summary
private static final Oid[] nameTypes
NT_GSS_KRB5_PRINCIPALback to summary
pack-priv static final Oid NT_GSS_KRB5_PRINCIPAL
PROVIDERback to summary
pack-priv static final Provider PROVIDER

Constructor Detail

Krb5MechFactoryback to summary
public Krb5MechFactory()
Krb5MechFactoryback to summary
public Krb5MechFactory(GSSCaller caller)

Method Detail

createOidback to summary
private static Oid createOid(String oidStr)
getCredentialElementback to summary
public GSSCredentialSpi getCredentialElement(GSSNameSpi name, int initLifetime, int acceptLifetime, int usage) throws GSSException

Implements sun.security.jgss.spi.MechanismFactory.getCredentialElement.

Doc from sun.security.jgss.spi.MechanismFactory.getCredentialElement.

Creates a credential element for this mechanism to be included as part of a GSSCredential implementation. A GSSCredential is conceptually a container class of several credential elements from different mechanisms. A GSS-API credential can be used either for initiating GSS security contexts or for accepting them. This method also accepts parameters that indicate what usage is expected and how long the life of the credential should be. It is not necessary that the mechanism honor the request for lifetime. An application will always query an acquired GSSCredential to determine what lifetime it got back.

Not all mechanisms support the concept of one credential element that can be used for both initiating and accepting a context. In the event that an application requests usage INITIATE_AND_ACCEPT for a credential from such a mechanism, the GSS framework will need to obtain two different credential elements from the mechanism, one that will have usage INITIATE_ONLY and another that will have usage ACCEPT_ONLY. The mechanism will help the GSS-API realize this by returning a credential element with usage INITIATE_ONLY or ACCEPT_ONLY prompting it to make another call to getCredentialElement, this time with the other usage mode. The mechanism indicates the missing mode by returning a 0 lifetime for it.

Exceptions
GSSException:
if one of the error situations described in RFC 2743 with the GSS_Acquire_Cred or GSS_Add_Cred calls occurs.
getCredFromSubjectback to summary
private static Krb5CredElement getCredFromSubject(GSSNameSpi name, boolean initiate) throws GSSException
getMechanismContextback to summary
public GSSContextSpi getMechanismContext(GSSNameSpi peer, GSSCredentialSpi myInitiatorCred, int lifetime) throws GSSException

Implements sun.security.jgss.spi.MechanismFactory.getMechanismContext.

Doc from sun.security.jgss.spi.MechanismFactory.getMechanismContext.

Creates a security context for this mechanism so that it can be used on the context initiator's side.

Exceptions
GSSException:
if any of the errors described in RFC 2743 in the GSS_Init_Sec_Context call occur.
getMechanismContextback to summary
public GSSContextSpi getMechanismContext(GSSCredentialSpi myAcceptorCred) throws GSSException

Implements sun.security.jgss.spi.MechanismFactory.getMechanismContext.

Doc from sun.security.jgss.spi.MechanismFactory.getMechanismContext.

Creates a security context for this mechanism so that it can be used on the context acceptor's side.

Exceptions
GSSException:
if any of the errors described in RFC 2743 in the GSS_Accept_Sec_Context call occur.
getMechanismContextback to summary
public GSSContextSpi getMechanismContext(byte[] exportedContext) throws GSSException

Implements sun.security.jgss.spi.MechanismFactory.getMechanismContext.

Doc from sun.security.jgss.spi.MechanismFactory.getMechanismContext.

Creates a security context from a previously exported (serialized) security context. Note that this is different from Java serialization and is defined at a mechanism level to interoperate over the wire with non-Java implementations. Either the initiator or the acceptor can export and then import a security context. Implementations of mechanism contexts are not required to implement exporting and importing.

Exceptions
GSSException:
is any of the errors described in RFC 2743 in the GSS_Import_Sec_Context call occur.
getMechanismOidback to summary
public Oid getMechanismOid()

Implements sun.security.jgss.spi.MechanismFactory.getMechanismOid.

Doc from sun.security.jgss.spi.MechanismFactory.getMechanismOid.

Returns the Oid of the mechanism that this factory supports.

getNameElementback to summary
public GSSNameSpi getNameElement(String nameStr, Oid nameType) throws GSSException

Implements sun.security.jgss.spi.MechanismFactory.getNameElement.

Doc from sun.security.jgss.spi.MechanismFactory.getNameElement.

Creates a name element for this mechanism to be included as part of a GSSName implementation. A GSSName is conceptually a container class of several name elements from different mechanisms. A GSSName can be created either with a String or with a sequence of bytes. This factory method accepts the name in a String. Such a name can generally be assumed to be printable and may be returned from the name element's toString() method.

Exceptions
GSSException:
if any of the errors described in RFC 2743 for the GSS_Import_Name or GSS_Canonicalize_Name calls occur.
getNameElementback to summary
public GSSNameSpi getNameElement(byte[] name, Oid nameType) throws GSSException

Implements sun.security.jgss.spi.MechanismFactory.getNameElement.

Doc from sun.security.jgss.spi.MechanismFactory.getNameElement.

This is a variation of the factory method that accepts a String for the characters that make up the name. Usually the String characters are assumed to be printable. The bytes passed in to this method have to be converted to characters using some encoding of the mechanism's choice. It is recommended that UTF-8 be used. (Note that UTF-8 preserves the encoding for 7-bit ASCII characters.)

An exported name will generally be passed in using this method.

Exceptions
GSSException:
if any of the errors described in RFC 2743 for the GSS_Import_Name or GSS_Canonicalize_Name calls occur.
getNameTypesback to summary
public Oid[] getNameTypes()

Implements sun.security.jgss.spi.MechanismFactory.getNameTypes.

Doc from sun.security.jgss.spi.MechanismFactory.getNameTypes.

Returns the GSS-API nametypes that this mechanism can support. Having this method helps the GSS-Framework decide quickly if a certain mechanism can be skipped when importing a name.

getProviderback to summary
public Provider getProvider()

Implements sun.security.jgss.spi.MechanismFactory.getProvider.

Doc from sun.security.jgss.spi.MechanismFactory.getProvider.

Returns the provider that this factory came from.