The interfaces contained in this package are
The MechanismFactory interface contains operations for creating concrete instances of GSSContextSpi, GSSCredentialSpi and GSSNameSpi interfaces.
As an example, consider an IBM provider that supports the Kerberos V5 mechanism (identified by the OID 1.2.840.113554.1.2.2). Further suppose that the factory class for the mechanism is called Krb5MechFactory and is contained in the package com.ibm.security.jgss.mech.krb5. Such a provider can be coded as
package com.ibm.security.jgss; import java.security.Provider; import java.security.AccessController; import java.security.PrivilegedAction; public final class IBMJGSSProvider extends Provider { public IBMJGSSProvider() { super("IBMJGSSProvider", 1.0, "IBMJGSSProvider supports Kerberos V5 Mechanism"); // Kerberos V5 mechanism OID is 1.2.840.113554.1.2.2 // Factory class name for the Kerberos V5 mechanism is // com.ibm.security.jgss.mech.krb5.Krb5MechFactory AccessController.doPrivileged(new PrivilegedAction() { public Object run() { put("GssApiMechanism.1.2.840.113554.1.2.2", "com.ibm.security.jgss.mech.krb5.Krb5MechFactory"); // If this provider supported multiple mechanisms, // we'd have additional "put" statements similar // to the one above. return null; } }); } }There are two ways to install a provider for the GSSAPI framework to use:
security.provider.1=sun.security.provider.Sun security.provider.2=com.ibm.crypto.provider.IBMJCE # Now the GSSAPI provider security.provider.2=com.ibm.crypto.provider.IBMJGSSProvider
GSSManager manager = GSSManager.getInstance(); Provider provider = new com.ibm.security.jgss.IBMJGGSProvider(); Oid krb5 = new Oid("1.2.840.113554.1.2.2"); manager.addProviderAtFront(provider, krb5);