Class GSSContext
The context object can be thought of as having 3 implicit states: before it is established, during its context establishment, and after a fully established context exists.
Before the context establishment phase is initiated, the context initiator may request specific characteristics desired of the established context. These can be set using the set methods. After the context is established, the caller can check the actual characteristic and services offered by the context using the query methods.
The context establishment phase begins with the first call to the init method by the context initiator. During this phase the init and accept methods will produce GSS-API authentication tokens which the calling application needs to send to its peer. The init and accept methods may return a CONTINUE_NEEDED code which indicates that a token is needed from its peer in order to continue the context establishment phase. A return code of COMPLETE signals that the local end of the context is established. This may still require that a token be sent to the peer, depending if one is produced by GSS-API. The isEstablished method can also be used to determine if the local end of the context has been fully established. During the context establishment phase, the isProtReady method may be called to determine if the context can be used for the per-message operations. This allows implementation to use per-message operations on contexts which aren't fully established.
After the context has been established or the isProtReady method returns "true", the query routines can be invoked to determine the actual characteristics and services of the established context. The application can also start using the per-message methods of wrap and getMIC to obtain cryptographic operations on application supplied data.
When the context is no longer needed, the application should call dispose to release any system resources the context may be using.
- RFC 2078
- This class corresponds to the context level calls together with the per message calls of RFC 2078. The gss_init_sec_context and gss_accept_sec_context calls have been made simpler by only taking required parameters. The context can have its properties set before the first call to init. The supplementary status codes for the per-message operations are returned in an instance of the MessageProp class, which is used as an argument in these calls.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Context option flag - anonymity.static final int
Return value from either accept or init stating that the context creation phase is complete for this peer.static final int
Context option flag - confidentiality.static final int
Return value from either accept or init stating that another token is required from the peer to continue context creation.static final int
Context option flag - credential delegation.static final int
Indefinite lifetime value for a context.static final int
Context option flag - integrity.static final int
Context option flag - mutual authentication.static final int
Context option flag - replay detection.static final int
Context option flag - sequence detection.static final int
Context option flag - transferability (output flag only). -
Constructor Summary
ConstructorsConstructorDescriptionGSSContext
(byte[] interProcessToken) Constructor for creating a GSSContext from a previously exported context.GSSContext
(GSSCredential myCred) Constructor for creating a context on the acceptor' side.GSSContext
(GSSName peer, Oid mechOid, GSSCredential myCred, int lifetime) Constructor for creating a context on the initiator's side. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
accept
(byte[] inTok, int offset, int length) Called by the context acceptor upon receiving a token from the peer.int
accept
(InputStream inputBuf, OutputStream outputBuf) Called by the context acceptor upon receiving a token from the peer.void
dispose()
Release any system resources and cryptographic information stored in the context object.byte[]
export()
Provided to support the sharing of work between multiple processes.boolean
Returns true if this is an anonymous context.boolean
Returns the confidentiality service state over the context.Returns the delegated credential object on the acceptor's side.boolean
Returns the state of the delegated credentials for the context.boolean
Returns the integrity service state over the context.int
Returns the context lifetime in seconds.getMech()
Returns the mechanism oid for the context.byte[]
getMIC
(byte[] inMsg, int offset, int length, MessageProp msgProp) Returns a token containing a cryptographic MIC for the supplied message, for transfer to the peer application.void
getMIC
(InputStream inBuf, OutputStream outBuf, MessageProp msgProp) Produces a token containing a cryptographic MIC for the supplied message, for transfer to the peer application.boolean
Returns the state of the mutual authentication option for the context.boolean
Returns the state of the replay detection service for the context.boolean
Returns the state of the sequence detection service for the context.Retrieves the name of the context initiator.Retrieves the name of the context target (acceptor).int
getWrapSizeLimit
(int qop, boolean confReq, int maxTokenSize) Returns the maximum message size that, if presented to the wrap method with the same confReq and qop parameters will result in an output token containing no more then maxTokenSize bytes.byte[]
init
(byte[] inputBuf, int offset, int length) Called by the context initiator to start the context creation process.int
init
(InputStream inputBuf, OutputStream outputBuf) Called by the context initiator to start the context creation process.boolean
Returns true is this is a fully established context.boolean
Returns true if this is the initiator of the context.boolean
Indicates if the per message operations can be applied over the context.boolean
Indicates if the context is transferable to other processes through the use of the export method.void
requestAnonymity
(boolean state) Requests anonymous support over the context.void
requestConf
(boolean state) Requests that confidentiality service be available over the context.void
requestCredDeleg
(boolean state) Sets the request state of the credential delegation flag for the context.void
requestInteg
(boolean state) Requests that integrity service be available over the context.void
requestLifetime
(int lifetime) Sets the desired lifetime for the context in seconds.void
requestMutualAuth
(boolean state) Sets the request state of the mutual authentication flag for the context.void
requestReplayDet
(boolean state) Sets the request state of the replay detection service for the context.void
requestSequenceDet
(boolean state) Sets the request state of the sequence checking service for the context.void
Sets the channel bindings to be used during context establishment.byte[]
unwrap
(byte[] inBuf, int offset, int length, MessageProp msgProp) Used by the peer application to process tokens generated with the wrap call.void
unwrap
(InputStream inBuf, OutputStream outBuf, MessageProp msgProp) Used by the peer application to process tokens generated with the wrap call.void
verifyMIC
(byte[] inTok, int tokOffset, int tokLen, byte[] inMsg, int msgOffset, int msgLen, MessageProp msgProp) Verifies the cryptographic MIC, contained in the token parameter, over the supplied message.void
verifyMIC
(InputStream inTok, InputStream inMsg, MessageProp msgProp) Verifies the cryptographic MIC, contained in the token parameter, over the supplied message.byte[]
wrap
(byte[] inBuf, int offset, int length, MessageProp msgProp) Allows to apply per-message security services over the established security context.void
wrap
(InputStream inBuf, OutputStream outBuf, MessageProp msgProp) Allows to apply per-message security services over the established security context.
-
Field Details
-
INDEFINITE
public static final int INDEFINITEIndefinite lifetime value for a context. Set to the largest value for an int in Java.- See Also:
-
COMPLETE
public static final int COMPLETEReturn value from either accept or init stating that the context creation phase is complete for this peer. -
CONTINUE_NEEDED
public static final int CONTINUE_NEEDEDReturn value from either accept or init stating that another token is required from the peer to continue context creation. This may be returned several times indicating multiple token exchanges. -
CRED_DELEG
public static final int CRED_DELEGContext option flag - credential delegation.- See Also:
-
MUTUAL_AUTH
public static final int MUTUAL_AUTHContext option flag - mutual authentication.- See Also:
-
REPLAY_DET
public static final int REPLAY_DETContext option flag - replay detection.- See Also:
-
SEQUENCE_DET
public static final int SEQUENCE_DETContext option flag - sequence detection.- See Also:
-
ANON
public static final int ANONContext option flag - anonymity.- See Also:
-
CONF
public static final int CONFContext option flag - confidentiality.- See Also:
-
INTG
public static final int INTGContext option flag - integrity.- See Also:
-
TRANS
public static final int TRANSContext option flag - transferability (output flag only). Indicates if context may be transferred by using export().- See Also:
-
-
Constructor Details
-
GSSContext
public GSSContext(GSSName peer, Oid mechOid, GSSCredential myCred, int lifetime) throws GSSException Constructor for creating a context on the initiator's side. Context flags may be modified through the set methods prior to calling init().- Parameters:
peer
- Name of the target peer.mechOid
- Oid of the desired mechanism; may be null to indicate the default mechanismmyCred
- the credentials for the initiator; may be null to indicate desire to use the default credentialslifetime
- the request lifetime, in seconds, for the context- Throws:
GSSException
- with possible major codes of BAD_NAME, BAD_MECH, BAD_NAMETYPE.- See Also:
-
GSSContext
Constructor for creating a context on the acceptor' side. The context's properties will be determined from the input token supplied to accept().- Parameters:
myCred
- GSSCredential for the acceptor. Use null to request usage of default credentials.- Throws:
GSSException
- with possible major codes of BAD_NAME, BAD_MECH, BAD_NAMETYPE.- See Also:
-
GSSContext
Constructor for creating a GSSContext from a previously exported context. The context properties will be determined from the input token.- RFC 2078
- equivalent to gss_import_sec_context
- Parameters:
interProcessToken
- the token emitted from export routine- Throws:
GSSException
- with possible major codes of CONTEXT_EXPIRED, NO_CONTEXT, DEFECTIVE_TOKEN, UNAVAILABLE, UNAUTHORIZED, FAILURE- See Also:
-
-
Method Details
-
init
Called by the context initiator to start the context creation process. This is equivalent to the stream based method except that the token buffers are handled as byte arrays instead of using stream objects. This method may return an output token which the application will need to send to the peer for processing by the accept call. "null" return value indicates that no token needs to be sent to the peer. The application can call isEstablished to determine if the context establishment phase is complete for this peer. A return value of "false" from isEstablished indicates that more tokens are expected to be supplied to the init method. Please note that the init method may return a token for the peer, and isEstablished return "true" also. This indicates that the token needs to be sent to the peer, but the local end of the context is now fully established.Upon completion of the context establishment, the available context options may be queried through the get methods.
- RFC 2078
- equivalent to gss_init_sec_context; The requested context options can be set before the first call, and the available options can be obtained after the context is fully established.
- Parameters:
inputBuf
- token generated by the peer; this parameter is ignored on the first calloutputBuf
- token generated for the peer; this may be empty- Returns:
- establishment state of either COMPLETE or CONTINUE_NEEDED
- Throws:
GSSException
- with possible major values of DEFECTIVE_TOKEN, DEFECTIVE_CREDENTIAL, BAD_SIG, NO_CRED, CREDENTIALS_EXPIRED, BAD_BINDINGS, OLD_TOKEN, DUPLICATE_ELEMENT, BAD_NAMETYPE, BAD_NAME, BAD_MECH, and FAILURE- See Also:
-
init
Called by the context initiator to start the context creation process. This is equivalent to the byte array based method. This method may write an output token to the outputBuf, which the application will need to send to the peer for processing by the accept call. 0 bytes written to the output stream indicate that no token needs to be sent to the peer. The method will return either COMPLETE or CONTINUE_NEEDED indicating the status of the current context. A return value of COMPLETE indicates that the context establishment phase is complete for this peer, while CONTINUE_NEEDED means that another token is expected from the peer. The isEstablished method can also be used to determine this state. Note that it is possible to have a token for the peer while this method returns COMPLETE. This indicates that the local end of the context is established, but the token needs to be sent to the peer to complete the context establishment.The GSS-API authentication tokens contain a definitive start and end. This method will attempt to read one of these tokens per invocation, and may block on the stream if only part of the token is available.
Upon completion of the context establishment, the available context options may be queried through the get methods.
- RFC 2078
- equivalent to gss_init_sec_context; The requested context options can be set before the first call, and the available options can be obtained after the context is fully established.
- Parameters:
inputBuf
- token generated by the peer; this parameter is ignored on the first calloutputBuf
- token generated for the peer; this may be empty- Returns:
- establishment state of either COMPLETE or CONTINUE_NEEDED
- Throws:
GSSException
- with possible major values of DEFECTIVE_TOKEN, DEFECTIVE_CREDENTIAL, BAD_SIG, NO_CRED, CREDENTIALS_EXPIRED, BAD_BINDINGS, OLD_TOKEN, DUPLICATE_ELEMENT, BAD_NAMETYPE, BAD_NAME, BAD_MECH, and FAILURE- See Also:
-
accept
Called by the context acceptor upon receiving a token from the peer. This call is equivalent to the stream based method except that the token buffers are handled as byte arrays instead of using stream objects.This method may return an output token which the application will need to send to the peer for further processing by the init call. "null" return value indicates that no token needs to be sent to the peer. The application can call isEstablished to determine if the context establishment phase is complete for this peer. A return value of "false" from isEstablished indicates that more tokens are expected to be supplied to this method.
Please note that the accept method may return a token for the peer, and isEstablished return "true" also. This indicates that the token needs to be sent to the peer, but the local end of the context is now fully established.
Upon completion of the context establishment, the available context options may be queried through the get methods. Called by the context acceptor upon receiving a token from the peer. May need to be called again if returns CONTINUE_NEEDED.
- RFC 2078
- equivalent to gss_accept_sec_context; context options can obtained through the query methods
- Parameters:
inputToken
- token that was received from the initiatoroutputBut
- token generated for the peer; may be empty- Returns:
- creation state of either COMPLETE or CONTINUE_NEEDED
- Throws:
GSSException
- may be thrown with major status values of DEFECTIVE_TOKEN, DEFECTIVE_CREDENTIAL, BAD_SIG, NO_CRED, CREDENTIALS_EXPIRED, BAD_BINDINGS, OLD_TOKEN, DUPLICATE_ELEMENT, BAD_MECH, and FAILURE- See Also:
-
accept
Called by the context acceptor upon receiving a token from the peer. This call is equivalent to the byte array method. It may write an output token to the outputBuf, which the application will need to send to the peer for processing by its init method. 0 bytes written to the output stream indicate that no token needs to be sent to the peer. The method will return either COMPLETE or CONTINUE_NEEDED indicating the status of the current context. A return value of COMPLETE indicates that the context establishment phase is complete for this peer, while CONTINUE_NEEDED means that another token is expected from the peer. The isEstablished method can also be used to determine this state. Note that it is possible to have a token for the peer while this method returns COMPLETE. This indicates that the local end of the context is established, but the token needs to be sent to the peer to complete the context establishment.The GSS-API authentication tokens contain a definitive start and end. This method will attempt to read one of these tokens per invocation, and may block on the stream if only part of the token is available.
Upon completion of the context establishment, the available context options may be queried through the get methods.
- RFC 2078
- equivalent to gss_accept_sec_context; context options can obtained through the query methods
- Parameters:
inputToken
- token that was received from the initiatoroutputBut
- token generated for the peer; may be empty- Returns:
- creation state of either COMPLETE or CONTINUE_NEEDED
- Throws:
GSSException
- may be thrown with major status values of DEFECTIVE_TOKEN, DEFECTIVE_CREDENTIAL, BAD_SIG, NO_CRED, CREDENTIALS_EXPIRED, BAD_BINDINGS, OLD_TOKEN, DUPLICATE_ELEMENT, BAD_MECH, and FAILURE- See Also:
-
isEstablished
public boolean isEstablished()Returns true is this is a fully established context. Used after the init and accept methods to check if more tokens are needed from the peer.- Returns:
- boolean indicating if this side of the context is fully established.
-
dispose
Release any system resources and cryptographic information stored in the context object. This will invalidate the context.- RFC 2078
- equivalent to gss_delete_sec_context
- Throws:
GSSException
- with major codes NO_CONTEXT or FAILURE
-
getWrapSizeLimit
Returns the maximum message size that, if presented to the wrap method with the same confReq and qop parameters will result in an output token containing no more then maxTokenSize bytes.- RFC 2078
- equivalent to gss_wrap_size_limit
- Parameters:
qop
- quality of protection to apply to the messageconfReq
- boolean indicating if privacy should be appliedmaxTokenSize
- the maximum size of the token to be emitted from wrap- Returns:
- maximum input buffer size for encapsulation by wrap using the specified QOP and confReq without exceeding the maxTokenSize
- Throws:
GSSException
- with the possible major codes of BAD_QOP, CONTEXT_EXPIRED, and FAILURE.- See Also:
-
wrap
Allows to apply per-message security services over the established security context. The method will return a token with a cryptographic MIC and may optionally encrypt the specified inBuf. This method is equivalent i functionality to its stream counterpart. The returned byte array will contain both the MIC and the message. The msgProp object is used to specify a QOP value which selects cryptographic algorithms, and a privacy service, if supported by the chosen mechanism.Supports the wrapping and unwrapping of zero-length messages.
The application will be responsible for sending the token to the peer.
- RFC 2078
- equivalent to gss_wrap; MessageProp object is used to select QOP and confidentiality
- Parameters:
inBuf
- the application data to be protectedoffset
- the offset in the inBuf where the data beginslength
- the length of the data starting at offsetmsgPro
- indicates the desired QOP and confidentiality state, and upon return the actual QOP and message confidentiality state- Returns:
- buffer to be sent to the peer for processing by unwrap
- Throws:
GSSException
- with possible major codes of CONTEXT_EXPIRED, CREDENTIALS_EXPIRED, BAD_QOP, FAILURE.- See Also:
-
wrap
Allows to apply per-message security services over the established security context. The method will produce a token with a cryptographic MIC and may optionally encrypt the specified inBuf. The outBuf will contain both the MIC and the message. The msgProp object is used to specify a QOP value to select cryptographic algorithms, and a privacy service, if supported by the chosen mechanism.Supports the wrapping and unwrapping of zero-length messages.
The application will be responsible for sending the token to the peer.
- RFC 2078
- equivalent to gss_wrap; MessageProp object is used to select QOP and confidentiality
- Parameters:
inputBuf
- the application data to be protectedoutputBuf
- the token to be sent to the peermsgPro
- indicates the desired QOP and confidentiality state, and upon return the actual QOP and message confidentiality state- Throws:
GSSException
- with possible major codes of CONTEXT_EXPIRED, CREDENTIALS_EXPIRED, BAD_QOP, FAILURE.- See Also:
-
#wrap(byte,int,int,MessageProp)
unwrap(InputStream,OutputStream,MessageProp)
MessageProp
-
unwrap
Used by the peer application to process tokens generated with the wrap call. This call is equal in functionality to its stream counterpart. The method will return the message supplied in the peer application to the wrap call, verifying the embedded MIC. The msgProp instance will indicate whether the message was encrypted and will contain the QOP indicating the strength of protection that was used to provide the confidentiality and integrity services.Supports the wrapping and unwrapping of zero-length messages.
- RFC 2078
- equivalent to the gss_unwrap
- Parameters:
inBuf
- token received from peer application which was generated by call to wrapoffset
- within the inBuf where the token begins.length
- The length of the token in inBuf.msgProp
- Upon return from the this method, will contain QOP and privacy state of the supplied message as well as any supplementary status values.- Returns:
- the application message used in the wrap call
- Throws:
GSSException
- with possible major codes of DEFECTIVE_TOKEN, BAD_SIG, CONTEXT_EXPIRED, CREDENTIALS_EXPIRED, and FAILURE.- See Also:
-
unwrap
Used by the peer application to process tokens generated with the wrap call. This call is equal in functionality to its byte array counterpart. It will produce the message supplied in the peer application to the wrap call, verifying the embedded MIC. The msgProp parameter will indicate whether the message was encrypted and will contain the QOP indicating the strength of protection that was used to provide the confidentiality and integrity services. The msgProp object will also contain the supplementary status information for the token.Supports the wrapping and unwrapping of zero-length messages.
- RFC 2078
- equivalent to the gss_unwrap
- Parameters:
inBuf
- token received from peer application which was generated by call to wrapoutBuf
- original message passed into wrapmsgProp
- Upon return from the this method, will contain QOP and privacy state of the supplied message as well as any supplementary status values.- Throws:
GSSException
- with possible major codes of DEFECTIVE_TOKEN, BAD_SIG, CONTEXT_EXPIRED, CREDENTIALS_EXPIRED, and FAILURE.- See Also:
-
getMIC
Returns a token containing a cryptographic MIC for the supplied message, for transfer to the peer application. Unlike wrap, which encapsulates the user message in the returned token, only the message MIC is returned in the output token. This method is identical in functionality to its stream counterpart.Note that privacy can only be applied through the wrap call.
Supports the derivation of MICs from zero-length messages.
- RFC 2078
- equivalent to gss_getMIC
- Parameters:
inBuf
- message to apply security service tooffset
- The offset within the inMsg where the token begins.length
- the length of the application messagemsgProp
- Indicates the desired QOP to be used. Use QOP of 0 to indicate default value. The confidentiality flag is ignored. Upon return from this method, this object will contain the actual QOP applied (in case 0 was selected).- Returns:
- token containing cryptographic information for the requested security service over the passed in message
- Throws:
GSSException
- with possible major codes of CONTEXT_EXPIRED, BAD_QOP, FAILURE.- See Also:
-
getMIC(InputStream,OutputStream,MessageProp)
#verifyMIC(byte[],int,int,MessageProp)
MessageProp
-
getMIC
Produces a token containing a cryptographic MIC for the supplied message, for transfer to the peer application. Unlike wrap, which encapsulates the user message in the returned token, only the message MIC is produced in the output token. This method is identical in functionality to its byte array counterpart.Note that privacy can only be applied through the wrap call.
Supports the derivation of MICs from zero-length messages.
- RFC 2078
- equivalent to gss_getMIC
- Parameters:
inBuf
- Buffer containing the message to generate MIC over.outBuf
- The buffer to write the GSS-API output token into.msgProp
- Indicates the desired QOP to be used. Use QOP of 0 to indicate default value. The confidentiality flag is ignored. Upon return from this method, this object will contain the actual QOP applied (in case 0 was selected).- Throws:
GSSException
- with possible major codes of CONTEXT_EXPIRED, BAD_QOP, FAILURE.- See Also:
-
verifyMIC
public void verifyMIC(byte[] inTok, int tokOffset, int tokLen, byte[] inMsg, int msgOffset, int msgLen, MessageProp msgProp) throws GSSException Verifies the cryptographic MIC, contained in the token parameter, over the supplied message. The msgProp parameter will contain the QOP indicating the strength of protection that was applied to the message and any supplementary status values for the token. This method is equivalent in functionality to its stream counterpart.- RFC 2078
- equivalent to gss_verifyMIC
- Parameters:
inTok
- token generated by peer's getMIC methodtokOffset
- the offset within the inTok where the token beginstokLen
- the length of the tokeninMsg
- Application message to verify the Cryptographic MIC over.msgOffset
- the offset within the inMsg where the message beginsmsgLen
- the length of the messagemsgProp
- upon return from this method, this object will contain the applied QOP and supplementary status values for the supplied token. The privacy state will always be set to false.- Throws:
GSSException
- with possible major codes DEFECTIVE_TOKEN, BAD_SIG, CONTEXT_EXPIRED- See Also:
-
verifyMIC
public void verifyMIC(InputStream inTok, InputStream inMsg, MessageProp msgProp) throws GSSException Verifies the cryptographic MIC, contained in the token parameter, over the supplied message. The msgProp parameter will contain the QOP indicating the strength of protection that was applied to the message. This method is equivalent in functionality to its byte array counterpart.- RFC 2078
- equivalent to gss_verifyMIC
- Parameters:
inputTok
- Contains the token generated by peer's getMIC method.inputMsg
- Contains application message to verify the cryptographic MIC over.msgProp
- upon return from this method, this object will contain the applied QOP and supplementary statustatus values for the supplied token. The privacy state will always be set to false.- Throws:
GSSException
- with possible major codes DEFECTIVE_TOKEN, BAD_SIG, CONTEXT_EXPIRED- See Also:
-
verifyMIC(byte[],int,int,byte[],int,int,MessageProp)
#wrap(InputStream,OutputStream)
MessageProp
-
export
Provided to support the sharing of work between multiple processes. This routine will typically be used by the context-acceptor, in an application where a single process receives incoming connection requests and accepts security contexts over them, then passes the established context to one or more other processes for message exchange.This method deactivates the security context and creates an interprocess token which, when passed to the byte array constructor of the GSSContext class in another process, will re-activate the context in the second process.
Only a single instantiation of a given context may be active at any one time; a subsequent attempt by a context exporter to access the exported security context will fail.
- RFC 2078
- equivalent to gss_export_sec_context
- Returns:
- inter-process token representing the context in export form
- Throws:
GSSException
- with possible major codes of UNAVAILABLE, CONTEXT_EXPIRED, NO_CONTEXT, FAILURE.- See Also:
-
requestMutualAuth
Sets the request state of the mutual authentication flag for the context. This method is only valid before the context creation process begins and only for the initiator.- RFC 2078
- equivalent to the mutual_req_flag parameter in gss_init_sec_context
- Parameters:
Boolean
- representing if mutual authentication should be requested during context establishment.- Throws:
GSSException
- may be thrown- See Also:
-
requestReplayDet
Sets the request state of the replay detection service for the context. This method is only valid before the context creation process begins and only for the initiator.- RFC 2078
- equivalent to the replay_det_req_flag parameter in gss_init_sec_context
- Parameters:
Boolean
- representing if replay detection is desired over the established context.- Throws:
GSSException
- may be thrown- See Also:
-
requestSequenceDet
Sets the request state of the sequence checking service for the context. This method is only valid before the context creation process begins and only for the initiator.- RFC 2078
- equivalent to the sequence_req_flag parameter in gss_init_sec_context
- Parameters:
Boolean
- representing if sequence checking service is desired over the established context.- Throws:
GSSException
- may be thrown- See Also:
-
requestCredDeleg
Sets the request state of the credential delegation flag for the context. This method is only valid before the context creation process begins and only for the initiator.- RFC 2078
- equivalent to the deleg_req_flag parameter in gss_init_sec_context
- Parameters:
Boolean
- representing if credential delegation is desired.- Throws:
GSSException
- may be thrown- See Also:
-
requestAnonymity
Requests anonymous support over the context. This method is only valid before the context creation process begins and only for the initiator.- RFC 2078
- equivalent to anon_req_flag parameter in gss_init_sec_context
- Parameters:
Boolean
- representing if anonymity support is desired.- Throws:
GSSException
- may be thrown- See Also:
-
requestConf
Requests that confidentiality service be available over the context. This method is only valid before the context creation process begins and only for the initiator.- RFC 2078
- equivalent to the conf_req_flag parameter in gss_init_sec_context
- Parameters:
Boolean
- indicating if confidentiality services are to be requested for the context.- Throws:
GSSException
- may be thrown- See Also:
-
requestInteg
Requests that integrity service be available over the context. This method is only valid before the context creation process begins and only for the initiator.- RFC 2078
- equivalent to the integ_req_flag parameter in gss_init_sec_context
- Parameters:
Boolean
- indicating if integrity services are to be requested for the context.- Throws:
GSSException
- may be thrown- See Also:
-
requestLifetime
Sets the desired lifetime for the context in seconds. This method is only valid before the context creation process begins and only for the initiator.- RFC 2078
- equivalent to the lifetime_req parameter in gss_init_sec_context
- Parameters:
The
- desired context lifetime in seconds.- Throws:
GSSException
- may be thrown- See Also:
-
setChannelBinding
Sets the channel bindings to be used during context establishment. This method is only valid before the context creation process begins.- RFC 2078
- equivalent to the chan_bindings parameter in gss_init_sec_context and gss_accept_sec_context
- Parameters:
Channel
- binding to be used.- Throws:
GSSException
- may be thrown- See Also:
-
getDelegCredState
public boolean getDelegCredState()Returns the state of the delegated credentials for the context. When issued before context establishment completes or when the isProtReady method returns false, it returns the desired state, otherwise it will indicate the actual state over the established context.- RFC 2078
- equivalent to the deleg_state flag output parameter in gss_init_sec_context, gss_accept_sec_context and gss_inquire_context
- Returns:
- boolean indicating if delegated credentials are available
- See Also:
-
getMutualAuthState
public boolean getMutualAuthState()Returns the state of the mutual authentication option for the context. When issued before context establishment completes or when the isProtReady method returns false, it returns the desired state, otherwise it will indicate the actual state over the established context.- RFC 2078
- equivalent to the mutual_state flag output parameter in gss_init_sec_context, gss_accept_sec_context and gss_inquire_context
- Returns:
- boolean indicating state of mutual authentication option
- See Also:
-
getReplayDetState
public boolean getReplayDetState()Returns the state of the replay detection service for the context. When issued before context establishment completes or when the isProtReady method returns false, it returns the desired state, otherwise it will indicate the actual state over the established context.- RFC 2078
- equivalent to the replay_det_state flag output parameter in gss_init_sec_context, gss_accept_sec_context and gss_inquire_context
- Returns:
- boolean indicating replay detection state
- See Also:
-
getSequenceDetState
public boolean getSequenceDetState()Returns the state of the sequence detection service for the context. When issued before context establishment completes or when the isProtReady method returns false, it returns the desired state, otherwise it will indicate the actual state over the established context.- RFC 2078
- equivalent to the sequence_state flag output parameter in gss_init_sec_context, gss_accept_sec_context and gss_inquire_context
- Returns:
- boolean indicating sequence detection state
- See Also:
-
getAnonymityState
public boolean getAnonymityState()Returns true if this is an anonymous context. When issued before context establishment completes or when the isProtReady method returns false, it returns the desired state, otherwise it will indicate the actual state over the established context.- RFC 2078
- equivalent to the anon_state flag output parameter in gss_init_sec_context, gss_accept_sec_context and gss_inquire_context
- Returns:
- boolean indicating anonymity state
- See Also:
-
isTransferable
Indicates if the context is transferable to other processes through the use of the export method. This call is only valid on fully established contexts.- RFC 2078
- equivalent to the trans_state flag output parameter in gss_init_sec_context, gss_accept_sec_context and gss_inquire_context
- Returns:
- boolean indicating the transferability of the context
- Throws:
GSSException
- may be thrown- See Also:
-
isProtReady
public boolean isProtReady()Indicates if the per message operations can be applied over the context. Some mechanisms may allow to apply per-message operations before the context is fully established. This will also indicate that the get methods will return actual context state characteristics instead of the desired ones.- RFC 2078
- equivalent to the prot_ready_state flag output parameter in gss_init_sec_context and gss_accept_sec_context
- Returns:
- boolean indicating if per message operations are available
-
getConfState
public boolean getConfState()Returns the confidentiality service state over the context. When issued before context establishment completes or when the isProtReady method returns false, it returns the desired state, otherwise it will indicate the actual state over the established context.- RFC 2078
- equivalent to the conf_avail flag output parameter in gss_init_sec_context, gss_accept_sec_context and gss_inquire_context
- Returns:
- boolean indicating confidentiality state
- See Also:
-
getIntegState
public boolean getIntegState()Returns the integrity service state over the context. When issued before context establishment completes or when the isProtReady method returns false, it returns the desired state, otherwise it will indicate the actual state over the established context.- RFC 2078
- equivalent to the integ_avail flag output parameter in gss_init_sec_context, gss_accept_sec_context and gss_inquire_context
- Returns:
- boolean indicating integrity state
- See Also:
-
getLifetime
public int getLifetime()Returns the context lifetime in seconds. When issued before context establishment completes or when the isProtReady method returns false, it returns the desired lifetime, otherwise it will indicate the actual lifetime over the established context.- RFC 2078
- equivalent to the lifetime_rec output parameter in gss_init_sec_context, gss_accept_sec_context, gss_inquire_context and to gss_context_time call
- Returns:
- lifetime in seconds
- See Also:
-
getSrcName
Retrieves the name of the context initiator. This call is valid only after context has been fully established or when the isProtReady methods returns true.- RFC 2078
- equivalent to the src_name parameter in gss_accept_sec_context and gss_inquire_context
- Returns:
- name of the context initiator
- Throws:
GSSException
- with possible major codes of CONTEXT_EXPIRED and FAILURE- See Also:
-
getTargName
Retrieves the name of the context target (acceptor). This call is only valid on fully established contexts or when the isProtReady methods returns true.- RFC 2078
- equivalent to the targ_name parameter in gss_inquire_context
- Returns:
- name of the context target (acceptor)
- Throws:
GSSException
- with possible major codes of CONTEXT_EXPIRED and FAILURE- See Also:
-
getMech
Returns the mechanism oid for the context.- RFC 2078
- equivalent to the mech_type parameter in gss_accept_sec_context and gss_inquire_context
- Returns:
- Oid object for the context's mechanism
- Throws:
GSSException
- may be thrown when the mechanism oid can't be determined
-
getDelegCred
Returns the delegated credential object on the acceptor's side. To check for availability of delegated credentials call getDelegCredState. This call is only valid on fully established contexts.- RFC 2078
- equivalent to delegated_cred_handle parameter in gss_accept_sec_context
- Returns:
- delegated credential object for the context
- Throws:
GSSException
- with possible major codes of CONTEXT_EXPIRED and FAILURE- See Also:
-
isInitiator
Returns true if this is the initiator of the context. This call is only valid after the context creation process has started.- RFC 2078
- equivalent to locally_initiated output parameter in gss_inquire_context
- Returns:
- true if this is the context initiator
- Throws:
GSSException
- with possible major codes of CONTEXT_EXPIRED and FAILURE
-