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

pack-priv Class NativeGSSContext

extends Object
implements GSSContextSpi
Class Inheritance
All Implemented Interfaces
sun.security.jgss.spi.GSSContextSpi
Imports
org.ietf.jgss.*, java.lang.ref.Cleaner, java.security.Provider, sun.security.jgss.GSSHeader, .GSSUtil, .GSSExceptionImpl, sun.security.jgss.spi.*, sun.security.util.DerValue, .ObjectIdentifier, sun.security.jgss.spnego.NegTokenInit, .NegTokenTarg, java.io.*

This class is essentially a wrapper class for the gss_ctx_id_t structure of the native GSS library.
Author
Valerie Peng
Since
1.6

Field Summary

Modifier and TypeField and Description
private Oid
private ChannelBinding
private Cleaner.Cleanable
private GSSCredElement
private final GSSLibStub
private GSSCredElement
private GSSCredElement
private GSSCredElement
private int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private boolean
private final boolean
private int
private static final int
private long
private GSSNameElement
private GSSNameElement

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
pack-priv
NativeGSSContext(long pCtxt, GSSLibStub stub)

Method Summary

Modifier and TypeMethod and Description
public byte[]
acceptSecContext(InputStream is, int mechTokenLen)

Implements sun.security.jgss.spi.GSSContextSpi.acceptSecContext.

Acceptor's context establishment call.

private void
changeFlags(int flagMask, boolean isEnable)

private boolean
checkFlags(int flagMask)

public void
dispose()

Implements sun.security.jgss.spi.GSSContextSpi.dispose.

Releases context resources and terminates the context between 2 peer.

private static Runnable
disposerFor(GSSLibStub stub, long pContext)

public byte[]
export()

Implements sun.security.jgss.spi.GSSContextSpi.export.

Produces a token representing this context.

public boolean
public boolean
public boolean
public GSSCredentialSpi
public boolean
public boolean
public int
public Oid
private static Oid
getMechFromSpNegoToken(byte[] token, boolean isInitiator)

public byte[]
getMIC(byte[] in, int offset, int len, MessageProp msgProp)

Implements sun.security.jgss.spi.GSSContextSpi.getMIC.

public void
getMIC(InputStream inStream, OutputStream outStream, MessageProp msgProp)

Implements sun.security.jgss.spi.GSSContextSpi.getMIC.

Applies per-message integrity services.

public boolean
public Provider
public boolean
public boolean
public GSSNameSpi
public GSSNameSpi
public int
getWrapSizeLimit(int qop, boolean confReq, int maxTokenSize)

Implements sun.security.jgss.spi.GSSContextSpi.getWrapSizeLimit.

Queries the context for largest data size to accommodate the specified protection and for the token to remain less than maxTokSize.

public byte[]
initSecContext(InputStream is, int mechTokenLen)

Implements sun.security.jgss.spi.GSSContextSpi.initSecContext.

Initiator context establishment call.

public Object
inquireSecContext(String type)

Implements sun.security.jgss.spi.GSSContextSpi.inquireSecContext.

Return the mechanism-specific attribute associated with type.

public boolean
public boolean
public boolean
public boolean
public void
public void
public void
public void
public void
public void
public void
public void
public void
private byte[]
retrieveToken(InputStream is, int mechTokenLen)

public void
private void
setContext(long pContext)

public byte[]
unwrap(byte[] inBuf, int offset, int len, MessageProp msgProp)

Implements sun.security.jgss.spi.GSSContextSpi.unwrap.

For apps that want simplicity and don't care about buffer copies.

public int
unwrap(byte[] inBuf, int inOffset, int len, byte[] outBuf, int outOffset, MessageProp msgProp)

public void
unwrap(InputStream inStream, OutputStream outStream, MessageProp msgProp)

Implements sun.security.jgss.spi.GSSContextSpi.unwrap.

Retrieves the message token previously encapsulated in the wrap call.

public int
unwrap(InputStream inStream, byte[] outBuf, int outOffset, MessageProp msgProp)

public void
verifyMIC(byte[] inToken, int tOffset, int tLen, byte[] inMsg, int mOffset, int mLen, MessageProp msgProp)

Implements sun.security.jgss.spi.GSSContextSpi.verifyMIC.

public void
verifyMIC(InputStream tokStream, InputStream msgStream, MessageProp msgProp)

Implements sun.security.jgss.spi.GSSContextSpi.verifyMIC.

Checks the integrity of the supplied tokens.

public byte[]
wrap(byte[] inBuf, int offset, int len, MessageProp msgProp)

Implements sun.security.jgss.spi.GSSContextSpi.wrap.

For apps that want simplicity and don't care about buffer copies.

public void
wrap(byte[] inBuf, int offset, int len, OutputStream os, MessageProp msgProp)

public int
wrap(byte[] inBuf, int inOffset, int len, byte[] outBuf, int outOffset, MessageProp msgProp)

public void
wrap(InputStream inStream, OutputStream outStream, MessageProp msgProp)

Implements sun.security.jgss.spi.GSSContextSpi.wrap.

Provides per-message token encapsulation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

actualMechback to summary
private Oid actualMech
cbback to summary
private ChannelBinding cb
cleanableback to summary
private Cleaner.Cleanable cleanable
credback to summary
private GSSCredElement cred
cStubback to summary
private final GSSLibStub cStub
delegatedCredback to summary
private GSSCredElement delegatedCred
disposeCredback to summary
private GSSCredElement disposeCred
disposeDelegatedCredback to summary
private GSSCredElement disposeDelegatedCred
flagsback to summary
private int flags
GSS_C_ANON_FLAGback to summary
private static final int GSS_C_ANON_FLAG
GSS_C_CONF_FLAGback to summary
private static final int GSS_C_CONF_FLAG
GSS_C_DELEG_FLAGback to summary
private static final int GSS_C_DELEG_FLAG
GSS_C_INTEG_FLAGback to summary
private static final int GSS_C_INTEG_FLAG
GSS_C_MUTUAL_FLAGback to summary
private static final int GSS_C_MUTUAL_FLAG
GSS_C_PROT_READY_FLAGback to summary
private static final int GSS_C_PROT_READY_FLAG
GSS_C_REPLAY_FLAGback to summary
private static final int GSS_C_REPLAY_FLAG
GSS_C_SEQUENCE_FLAGback to summary
private static final int GSS_C_SEQUENCE_FLAG
GSS_C_TRANS_FLAGback to summary
private static final int GSS_C_TRANS_FLAG
isEstablishedback to summary
private boolean isEstablished
isInitiatorback to summary
private final boolean isInitiator
lifetimeback to summary
private int lifetime
NUM_OF_INQUIRE_VALUESback to summary
private static final int NUM_OF_INQUIRE_VALUES
pContextback to summary
private long pContext
srcNameback to summary
private GSSNameElement srcName
targetNameback to summary
private GSSNameElement targetName

Constructor Detail

NativeGSSContextback to summary
pack-priv NativeGSSContext(GSSNameElement peer, GSSCredElement myCred, int time, GSSLibStub stub) throws GSSException
NativeGSSContextback to summary
pack-priv NativeGSSContext(GSSCredElement myCred, GSSLibStub stub) throws GSSException
NativeGSSContextback to summary
pack-priv NativeGSSContext(long pCtxt, GSSLibStub stub) throws GSSException

Method Detail

acceptSecContextback to summary
public byte[] acceptSecContext(InputStream is, int mechTokenLen) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.acceptSecContext.

Doc from sun.security.jgss.spi.GSSContextSpi.acceptSecContext.

Acceptor's context establishment call. This method may be required to be called several times. A CONTINUE_NEEDED return call indicates that more calls are needed after the next token is received from the peer.

This method is called by the GSS-Framework when the application calls the acceptSecContext method on the GSSContext implementation that it has a reference to.

All overloaded forms of GSSContext.acceptSecContext() can be handled with this mechanism level acceptSecContext. Since the output token from this method is a fixed size, not exceedingly large, and a one time deal, an overloaded form that takes an OutputStream has not been defined. The GSS-Framework can write the returned byte[] to any application provided OutputStream. Similarly, any application input in the form of byte arrays will be wrapped in an input stream by the GSS-Framework and then passed here.

The GSS-Framework will strip off the leading mechanism independent GSS-API header. In other words, only the mechanism specific inner-context token of RFC 2743 section 3.1 will be available on the InputStream.

Exceptions
GSSException:
may be thrown
changeFlagsback to summary
private void changeFlags(int flagMask, boolean isEnable)
checkFlagsback to summary
private boolean checkFlags(int flagMask)
disposeback to summary
public void dispose()

Implements sun.security.jgss.spi.GSSContextSpi.dispose.

Doc from sun.security.jgss.spi.GSSContextSpi.dispose.

Releases context resources and terminates the context between 2 peer.

disposerForback to summary
private static Runnable disposerFor(GSSLibStub stub, long pContext)
exportback to summary
public byte[] export() throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.export.

Doc from sun.security.jgss.spi.GSSContextSpi.export.

Produces a token representing this context. After this call the context will no longer be usable until an import is performed on the returned token.

Exceptions
GSSException:
may be thrown
getAnonymityStateback to summary
public boolean getAnonymityState()

Implements sun.security.jgss.spi.GSSContextSpi.getAnonymityState.

getConfStateback to summary
public boolean getConfState()

Implements sun.security.jgss.spi.GSSContextSpi.getConfState.

getCredDelegStateback to summary
public boolean getCredDelegState()

Implements sun.security.jgss.spi.GSSContextSpi.getCredDelegState.

getDelegCredback to summary
public GSSCredentialSpi getDelegCred() throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.getDelegCred.

getDelegPolicyStateback to summary
public boolean getDelegPolicyState()

Implements sun.security.jgss.spi.GSSContextSpi.getDelegPolicyState.

getIntegStateback to summary
public boolean getIntegState()

Implements sun.security.jgss.spi.GSSContextSpi.getIntegState.

getLifetimeback to summary
public int getLifetime()

Implements sun.security.jgss.spi.GSSContextSpi.getLifetime.

getMechback to summary
public Oid getMech() throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.getMech.

getMechFromSpNegoTokenback to summary
private static Oid getMechFromSpNegoToken(byte[] token, boolean isInitiator) throws GSSException
getMICback to summary
public byte[] getMIC(byte[] in, int offset, int len, MessageProp msgProp) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.getMIC.

getMICback to summary
public void getMIC(InputStream inStream, OutputStream outStream, MessageProp msgProp) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.getMIC.

Doc from sun.security.jgss.spi.GSSContextSpi.getMIC.

Applies per-message integrity services.

getMutualAuthStateback to summary
public boolean getMutualAuthState()

Implements sun.security.jgss.spi.GSSContextSpi.getMutualAuthState.

getProviderback to summary
public Provider getProvider()

Implements sun.security.jgss.spi.GSSContextSpi.getProvider.

getReplayDetStateback to summary
public boolean getReplayDetState()

Implements sun.security.jgss.spi.GSSContextSpi.getReplayDetState.

getSequenceDetStateback to summary
public boolean getSequenceDetState()

Implements sun.security.jgss.spi.GSSContextSpi.getSequenceDetState.

getSrcNameback to summary
public GSSNameSpi getSrcName() throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.getSrcName.

getTargNameback to summary
public GSSNameSpi getTargName() throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.getTargName.

getWrapSizeLimitback to summary
public int getWrapSizeLimit(int qop, boolean confReq, int maxTokenSize) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.getWrapSizeLimit.

Doc from sun.security.jgss.spi.GSSContextSpi.getWrapSizeLimit.

Queries the context for largest data size to accommodate the specified protection and for the token to remain less than maxTokSize.

Exceptions
GSSException:
may be thrown
initSecContextback to summary
public byte[] initSecContext(InputStream is, int mechTokenLen) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.initSecContext.

Doc from sun.security.jgss.spi.GSSContextSpi.initSecContext.

Initiator context establishment call. This method may be required to be called several times. A CONTINUE_NEEDED return call indicates that more calls are needed after the next token is received from the peer.

This method is called by the GSS-Framework when the application calls the initSecContext method on the GSSContext implementation that it has a reference to.

All overloaded forms of GSSContext.initSecContext() can be handled with this mechanism level initSecContext. Since the output token from this method is a fixed size, not exceedingly large, and a one time deal, an overloaded form that takes an OutputStream has not been defined. The GSS-Framework can write the returned byte[] to any application provided OutputStream. Similarly, any application input in the form of byte arrays will be wrapped in an input stream by the GSS-Framework and then passed here.

The GSS-Framework will strip off the leading mechanism independent GSS-API header. In other words, only the mechanism specific inner-context token of RFC 2743 section 3.1 will be available on the InputStream.

Exceptions
GSSException:
may be thrown
inquireSecContextback to summary
public Object inquireSecContext(String type) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.inquireSecContext.

Doc from sun.security.jgss.spi.GSSContextSpi.inquireSecContext.

Return the mechanism-specific attribute associated with type.

Exceptions
GSSException:
see ExtendedGSSContext#inquireSecContext for details
isEstablishedback to summary
public boolean isEstablished()

Implements sun.security.jgss.spi.GSSContextSpi.isEstablished.

isInitiatorback to summary
public boolean isInitiator()

Implements sun.security.jgss.spi.GSSContextSpi.isInitiator.

isProtReadyback to summary
public boolean isProtReady()

Implements sun.security.jgss.spi.GSSContextSpi.isProtReady.

isTransferableback to summary
public boolean isTransferable() throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.isTransferable.

requestAnonymityback to summary
public void requestAnonymity(boolean state) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.requestAnonymity.

requestConfback to summary
public void requestConf(boolean state) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.requestConf.

requestCredDelegback to summary
public void requestCredDeleg(boolean state) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.requestCredDeleg.

requestDelegPolicyback to summary
public void requestDelegPolicy(boolean state) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.requestDelegPolicy.

requestIntegback to summary
public void requestInteg(boolean state) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.requestInteg.

requestLifetimeback to summary
public void requestLifetime(int lifetime) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.requestLifetime.

requestMutualAuthback to summary
public void requestMutualAuth(boolean state) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.requestMutualAuth.

requestReplayDetback to summary
public void requestReplayDet(boolean state) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.requestReplayDet.

requestSequenceDetback to summary
public void requestSequenceDet(boolean state) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.requestSequenceDet.

retrieveTokenback to summary
private byte[] retrieveToken(InputStream is, int mechTokenLen) throws GSSException
setChannelBindingback to summary
public void setChannelBinding(ChannelBinding cb) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.setChannelBinding.

setContextback to summary
private void setContext(long pContext)
unwrapback to summary
public byte[] unwrap(byte[] inBuf, int offset, int len, MessageProp msgProp) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.unwrap.

Doc from sun.security.jgss.spi.GSSContextSpi.unwrap.

For apps that want simplicity and don't care about buffer copies.

unwrapback to summary
public int unwrap(byte[] inBuf, int inOffset, int len, byte[] outBuf, int outOffset, MessageProp msgProp) throws GSSException
unwrapback to summary
public void unwrap(InputStream inStream, OutputStream outStream, MessageProp msgProp) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.unwrap.

Doc from sun.security.jgss.spi.GSSContextSpi.unwrap.

Retrieves the message token previously encapsulated in the wrap call.

Exceptions
GSSException:
may be thrown
unwrapback to summary
public int unwrap(InputStream inStream, byte[] outBuf, int outOffset, MessageProp msgProp) throws GSSException
verifyMICback to summary
public void verifyMIC(byte[] inToken, int tOffset, int tLen, byte[] inMsg, int mOffset, int mLen, MessageProp msgProp) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.verifyMIC.

verifyMICback to summary
public void verifyMIC(InputStream tokStream, InputStream msgStream, MessageProp msgProp) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.verifyMIC.

Doc from sun.security.jgss.spi.GSSContextSpi.verifyMIC.

Checks the integrity of the supplied tokens. This token was previously generated by getMIC.

Exceptions
GSSException:
may be thrown
wrapback to summary
public byte[] wrap(byte[] inBuf, int offset, int len, MessageProp msgProp) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.wrap.

Doc from sun.security.jgss.spi.GSSContextSpi.wrap.

For apps that want simplicity and don't care about buffer copies.

wrapback to summary
public void wrap(byte[] inBuf, int offset, int len, OutputStream os, MessageProp msgProp) throws GSSException
wrapback to summary
public int wrap(byte[] inBuf, int inOffset, int len, byte[] outBuf, int outOffset, MessageProp msgProp) throws GSSException
wrapback to summary
public void wrap(InputStream inStream, OutputStream outStream, MessageProp msgProp) throws GSSException

Implements sun.security.jgss.spi.GSSContextSpi.wrap.

Doc from sun.security.jgss.spi.GSSContextSpi.wrap.

Provides per-message token encapsulation.

Exceptions
GSSException:
may be thrown