2362N/A * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * This interface encapsulates the GSS-API security context and provides 0N/A * the security services that are available over the context. Security 0N/A * contexts are established between peers using locally acquired 0N/A * credentials. Multiple contexts may exist simultaneously between a pair 0N/A * of peers, using the same or different set of credentials. GSS-API 0N/A * functions in a manner independent of the underlying transport protocol 0N/A * and depends on its calling application to transport the tokens that are 0N/A * generated by the security context between the peers.<p> 0N/A * If the caller instantiates the context using the default 0N/A * <code>GSSManager</code> instance, then the Kerberos v5 GSS-API mechanism 0N/A * is guaranteed to be available for context establishment. This mechanism 0N/A * is identified by the Oid "1.2.840.113554.1.2.2" and is defined in RFC 0N/A * Before the context establishment phase is initiated, the context 0N/A * initiator may request specific characteristics desired of the 0N/A * established context. Not all underlying mechanisms support all 0N/A * characteristics that a caller might desire. After the context is 0N/A * established, the caller can check the actual characteristics and services 0N/A * offered by that context by means of various query methods. When using 0N/A * the Kerberos v5 GSS-API mechanism offered by the default 0N/A * <code>GSSManager</code> instance, all optional services will be 0N/A * available locally. They are mutual authentication, credential 0N/A * delegation, confidentiality and integrity protection, and per-message 0N/A * replay detection and sequencing. Note that in the GSS-API, message integrity 0N/A * is a prerequisite for message confidentiality.<p> 0N/A * The context establishment occurs in a loop where the 0N/A * initiator calls {@link #initSecContext(byte[], int, int) initSecContext} 0N/A * and the acceptor calls {@link #acceptSecContext(byte[], int, int) 0N/A * acceptSecContext} until the context is established. While in this loop 0N/A * the <code>initSecContext</code> and <code>acceptSecContext</code> 0N/A * methods produce tokens that the application sends over to the peer. The 0N/A * peer passes any such token as input to its <code>acceptSecContext</code> 0N/A * or <code>initSecContext</code> as the case may be.<p> 0N/A * During the context establishment phase, the {@link 0N/A * #isProtReady() isProtReady} method may be called to determine if the 0N/A * context can be used for the per-message operations of {@link 0N/A * #wrap(byte[], int, int, MessageProp) wrap} and {@link #getMIC(byte[], 0N/A * int, int, MessageProp) getMIC}. This allows applications to use 0N/A * per-message operations on contexts which aren't yet fully 0N/A * After the context has been established or the <code>isProtReady</code> 0N/A * method returns <code>true</code>, the query routines can be invoked to 0N/A * determine the actual characteristics and services of the established 0N/A * context. The application can also start using the per-message methods 0N/A * of {@link #wrap(byte[], int, int, MessageProp) wrap} and 0N/A * {@link #getMIC(byte[], int, int, MessageProp) getMIC} to obtain 0N/A * cryptographic operations on application supplied data.<p> 0N/A * When the context is no longer needed, the application should call 0N/A * {@link #dispose() dispose} to release any system resources the context 0N/A * A security context typically maintains sequencing and replay detection 0N/A * information about the tokens it processes. Therefore, the sequence in 0N/A * which any tokens are presented to this context for processing can be 0N/A * important. Also note that none of the methods in this interface are 0N/A * synchronized. Therefore, it is not advisable to share a 0N/A * <code>GSSContext</code> among several threads unless some application 0N/A * level synchronization is in place.<p> 0N/A * Finally, different mechanism providers might place different security 0N/A * restrictions on using GSS-API contexts. These will be documented by the 0N/A * mechanism provider. The application will need to ensure that it has the 0N/A * appropriate permissions if such checks are made in the mechanism layer.<p> 0N/A * The example code presented below demonstrates the usage of the 0N/A * <code>GSSContext</code> interface for the initiating peer. Different 0N/A * operations on the <code>GSSContext</code> object are presented, 0N/A * including: object instantiation, setting of desired flags, context 0N/A * establishment, query of actual context flags, per-message operations on 0N/A * application data, and finally context deletion.<p> 0N/A * // Create a context using default credentials 0N/A * // and the implementation specific default mechanism 0N/A * GSSManager manager ... 0N/A * GSSName targetName ... 0N/A * GSSContext context = manager.createContext(targetName, null, null, 0N/A * GSSContext.INDEFINITE_LIFETIME); 0N/A * // set desired context options prior to context establishment 0N/A * context.requestConf(true); 0N/A * context.requestMutualAuth(true); 0N/A * context.requestReplayDet(true); 0N/A * context.requestSequenceDet(true); 0N/A * // establish a context between peers 0N/A * byte []inToken = new byte[0]; 0N/A * // Loop while there still is a token to be processed 0N/A * while (!context.isEstablished()) { 0N/A * // send the output token if generated 0N/A * if (outToken != null) 0N/A * sendToken(outToken); 0N/A * if (!context.isEstablished()) { 0N/A * inToken = readToken(); 0N/A * // display context information 0N/A * System.out.println("Remaining lifetime in seconds = " 0N/A * + context.getLifetime()); 0N/A * System.out.println("Context mechanism = " + context.getMech()); 0N/A * System.out.println("Initiator = " + context.getSrcName()); 0N/A * System.out.println("Acceptor = " + context.getTargName()); 0N/A * if (context.getConfState()) 0N/A * System.out.println("Confidentiality (i.e., privacy) is available"); 0N/A * if (context.getIntegState()) 0N/A * System.out.println("Integrity is available"); 0N/A * // perform wrap on an application supplied message, appMsg, 0N/A * // using QOP = 0, and requesting privacy service 0N/A * byte [] appMsg ... 0N/A * MessageProp mProp = new MessageProp(0, true); 0N/A * byte []tok = context.wrap(appMsg, 0, appMsg.length, mProp); 0N/A * // release the local-end of the context 0N/A * context.dispose(); 0N/A * @author Mayank Upadhyay 0N/A * A lifetime constant representing the default context lifetime. This 0N/A * value is set to 0. 0N/A * A lifetime constant representing indefinite context lifetime. 0N/A * This value must is set to the maximum integer value in Java - 0N/A * {@link java.lang.Integer#MAX_VALUE Integer.MAX_VALUE}. 0N/A * Called by the context initiator to start the context creation 0N/A * phase and process any tokens generated 0N/A * by the peer's <code>acceptSecContext</code> method. 0N/A * This method may return an output token which the application will need 0N/A * to send to the peer for processing by its <code>acceptSecContext</code> 0N/A * method. The application can call {@link #isEstablished() 0N/A * isEstablished} to determine if the context establishment phase is 0N/A * complete on this side of the context. A return value of 0N/A * <code>false</code> from <code>isEstablished</code> indicates that 0N/A * more tokens are expected to be supplied to 0N/A * <code>initSecContext</code>. Upon completion of the context 0N/A * establishment, the available context options may be queried through 0N/A * the get methods.<p> 0N/A * Note that it is possible that the <code>initSecContext</code> method 0N/A * return a token for the peer, and <code>isEstablished</code> return 0N/A * <code>true</code> also. This indicates that the token needs to be sent 0N/A * to the peer, but the local end of the context is now fully 0N/A * Some mechanism providers might require that the caller be granted 0N/A * permission to initiate a security context. A failed permission check 0N/A * might cause a {@link java.lang.SecurityException SecurityException} 0N/A * to be thrown from this method.<p> 0N/A * @return a byte[] containing the token to be sent to the 0N/A * peer. <code>null</code> indicates that no token is generated. 0N/A * @param inputBuf token generated by the peer. This parameter is ignored 0N/A * on the first call since no token has been received from the peer. 0N/A * @param offset the offset within the inputBuf where the token begins. 0N/A * @param len the length of the token. 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN}, 0N/A * {@link GSSException#BAD_MIC GSSException.BAD_MIC}, 0N/A * {@link GSSException#NO_CRED GSSException.NO_CRED}, 0N/A * {@link GSSException#CREDENTIALS_EXPIRED 0N/A * GSSException.CREDENTIALS_EXPIRED}, 0N/A * {@link GSSException#BAD_BINDINGS GSSException.BAD_BINDINGS}, 0N/A * {@link GSSException#OLD_TOKEN GSSException.OLD_TOKEN}, 0N/A * {@link GSSException#DUPLICATE_TOKEN GSSException.DUPLICATE_TOKEN}, 0N/A * {@link GSSException#BAD_NAMETYPE GSSException.BAD_NAMETYPE}, 0N/A * {@link GSSException#BAD_MECH GSSException.BAD_MECH}, 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Called by the context initiator to start the context creation 0N/A * phase and process any tokens generated 0N/A * by the peer's <code>acceptSecContext</code> method using 0N/A * streams. This method may write an output token to the 0N/A * <code>OutpuStream</code>, which the application will 0N/A * need to send to the peer for processing by its 0N/A * <code>acceptSecContext</code> call. Typically, the application would 0N/A * ensure this by calling the {@link java.io.OutputStream#flush() flush} 0N/A * method on an <code>OutputStream</code> that encapsulates the 0N/A * connection between the two peers. The application can 0N/A * determine if a token is written to the OutputStream from the return 0N/A * value of this method. A return value of <code>0</code> indicates that 0N/A * no token was written. The application can call 0N/A * {@link #isEstablished() isEstablished} to determine if the context 0N/A * establishment phase is complete on this side of the context. A 0N/A * return value of <code>false</code> from <code>isEstablished</code> 0N/A * indicates that more tokens are expected to be supplied to 0N/A * <code>initSecContext</code>. 0N/A * Upon completion of the context establishment, the available context 0N/A * options may be queried through the get methods.<p> 0N/A * Note that it is possible that the <code>initSecContext</code> method 0N/A * return a token for the peer, and <code>isEstablished</code> return 0N/A * <code>true</code> also. This indicates that the token needs to be sent 0N/A * to the peer, but the local end of the context is now fully 0N/A * The GSS-API authentication tokens contain a definitive start and 0N/A * end. This method will attempt to read one of these tokens per 0N/A * invocation, and may block on the stream if only part of the token is 0N/A * available. In all other respects this method is equivalent to the 0N/A * byte array based {@link #initSecContext(byte[], int, int) 0N/A * initSecContext}.<p> 0N/A * Some mechanism providers might require that the caller be granted 0N/A * permission to initiate a security context. A failed permission check 0N/A * might cause a {@link java.lang.SecurityException SecurityException} 0N/A * to be thrown from this method.<p> 0N/A * The following example code demonstrates how this method might be 0N/A * InputStream is ... 0N/A * OutputStream os ... 0N/A * GSSContext context ... 0N/A * // Loop while there is still a token to be processed 0N/A * while (!context.isEstablished()) { 0N/A * // send output token if generated 0N/A * @return the number of bytes written to the OutputStream as part of the 0N/A * token to be sent to the peer. A value of 0 indicates that no token 0N/A * @param inStream an InputStream that contains the token generated by 0N/A * the peer. This parameter is ignored on the first call since no token 0N/A * has been or will be received from the peer at that point. 0N/A * @param outStream an OutputStream where the output token will be 0N/A * written. During the final stage of context establishment, there may be 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN}, 0N/A * {@link GSSException#BAD_MIC GSSException.BAD_MIC}, 0N/A * {@link GSSException#NO_CRED GSSException.NO_CRED}, 0N/A * {@link GSSException#CREDENTIALS_EXPIRED GSSException.CREDENTIALS_EXPIRED}, 0N/A * {@link GSSException#BAD_BINDINGS GSSException.BAD_BINDINGS}, 0N/A * {@link GSSException#OLD_TOKEN GSSException.OLD_TOKEN}, 0N/A * {@link GSSException#DUPLICATE_TOKEN GSSException.DUPLICATE_TOKEN}, 0N/A * {@link GSSException#BAD_NAMETYPE GSSException.BAD_NAMETYPE}, 0N/A * {@link GSSException#BAD_MECH GSSException.BAD_MECH}, 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Called by the context acceptor upon receiving a token from the 0N/A * peer. This method may return an output token which the application 0N/A * will need to send to the peer for further processing by its 0N/A * <code>initSecContext</code> call.<p> 0N/A * The application can call {@link #isEstablished() isEstablished} to 0N/A * determine if the context establishment phase is complete for this 0N/A * peer. A return value of <code>false</code> from 0N/A * <code>isEstablished</code> indicates that more tokens are expected to 0N/A * be supplied to this method. Upon completion of the context 0N/A * establishment, the available context options may be queried through 0N/A * the get methods.<p> 0N/A * Note that it is possible that <code>acceptSecContext</code> return a 0N/A * token for the peer, and <code>isEstablished</code> return 0N/A * <code>true</code> also. This indicates that the token needs to be 0N/A * sent to the peer, but the local end of the context is now fully 0N/A * Some mechanism providers might require that the caller be granted 0N/A * permission to accept a security context. A failed permission check 0N/A * might cause a {@link java.lang.SecurityException SecurityException} 0N/A * to be thrown from this method.<p> 0N/A * The following example code demonstrates how this method might be 0N/A * GSSContext context ... 0N/A * // Loop while there is still a token to be processed 0N/A * while (!context.isEstablished()) { 0N/A * inToken = readToken(); 0N/A * outToken = context.acceptSecContext(inToken, 0, 0N/A * // send output token if generated 0N/A * if (outToken != null) 0N/A * sendToken(outToken); 0N/A * @return a byte[] containing the token to be sent to the 0N/A * peer. <code>null</code> indicates that no token is generated. 0N/A * @param inToken token generated by the peer. 0N/A * @param offset the offset within the inToken where the token begins. 0N/A * @param len the length of the token. 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN}, 0N/A * {@link GSSException#BAD_MIC GSSException.BAD_MIC}, 0N/A * {@link GSSException#NO_CRED GSSException.NO_CRED}, 0N/A * {@link GSSException#CREDENTIALS_EXPIRED 0N/A * GSSException.CREDENTIALS_EXPIRED}, 0N/A * {@link GSSException#BAD_BINDINGS GSSException.BAD_BINDINGS}, 0N/A * {@link GSSException#OLD_TOKEN GSSException.OLD_TOKEN}, 0N/A * {@link GSSException#DUPLICATE_TOKEN GSSException.DUPLICATE_TOKEN}, 0N/A * {@link GSSException#BAD_MECH GSSException.BAD_MECH}, 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Called by the context acceptor to process a token from the peer using 0N/A * streams. It may write an output token to the 0N/A * <code>OutputStream</code>, which the application 0N/A * will need to send to the peer for processing by its 0N/A * <code>initSecContext</code> method. Typically, the application would 0N/A * ensure this by calling the {@link java.io.OutputStream#flush() flush} 0N/A * method on an <code>OutputStream</code> that encapsulates the 0N/A * connection between the two peers. The application can call 0N/A * {@link #isEstablished() isEstablished} to determine if the context 0N/A * establishment phase is complete on this side of the context. A 0N/A * return value of <code>false</code> from <code>isEstablished</code> 0N/A * indicates that more tokens are expected to be supplied to 0N/A * <code>acceptSecContext</code>. 0N/A * Upon completion of the context establishment, the available context 0N/A * options may be queried through the get methods.<p> 0N/A * Note that it is possible that <code>acceptSecContext</code> return a 0N/A * token for the peer, and <code>isEstablished</code> return 0N/A * <code>true</code> also. This indicates that the token needs to be 0N/A * sent to the peer, but the local end of the context is now fully 0N/A * The GSS-API authentication tokens contain a definitive start and 0N/A * end. This method will attempt to read one of these tokens per 0N/A * invocation, and may block on the stream if only part of the token is 0N/A * available. In all other respects this method is equivalent to the byte 0N/A * array based {@link #acceptSecContext(byte[], int, int) 0N/A * acceptSecContext}.<p> 0N/A * Some mechanism providers might require that the caller be granted 0N/A * permission to accept a security context. A failed permission check 0N/A * might cause a {@link java.lang.SecurityException SecurityException} 0N/A * to be thrown from this method.<p> 0N/A * The following example code demonstrates how this method might be 0N/A * InputStream is ... 0N/A * OutputStream os ... 0N/A * GSSContext context ... 0N/A * // Loop while there is still a token to be processed 0N/A * while (!context.isEstablished()) { 0N/A * context.acceptSecContext(is, os); 0N/A * // send output token if generated 0N/A * @param inStream an InputStream that contains the token generated by 0N/A * @param outStream an OutputStream where the output token will be 0N/A * written. During the final stage of context establishment, there may be 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN}, 0N/A * {@link GSSException#BAD_MIC GSSException.BAD_MIC}, 0N/A * {@link GSSException#NO_CRED GSSException.NO_CRED}, 0N/A * {@link GSSException#CREDENTIALS_EXPIRED 0N/A * GSSException.CREDENTIALS_EXPIRED}, 0N/A * {@link GSSException#BAD_BINDINGS GSSException.BAD_BINDINGS}, 0N/A * {@link GSSException#OLD_TOKEN GSSException.OLD_TOKEN}, 0N/A * {@link GSSException#DUPLICATE_TOKEN GSSException.DUPLICATE_TOKEN}, 0N/A * {@link GSSException#BAD_MECH GSSException.BAD_MECH}, 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A /* Missing return value in RFC. int should have been returned. 0N/A * ----------------------------------------------------------- 0N/A * The application can determine if a token is written to the 0N/A * OutputStream from the return value of this method. A return value of 0N/A * <code>0</code> indicates that no token was written. 0N/A * @return <strong>the number of bytes written to the 0N/A * OutputStream as part of the token to be sent to the peer. A value of 0N/A * 0 indicates that no token needs to be 0N/A * Used during context establishment to determine the state of the 0N/A * @return <code>true</code> if this is a fully established context on 0N/A * the caller's side and no more tokens are needed from the peer. 0N/A * Releases any system resources and cryptographic information stored in 0N/A * the context object and invalidates the context. 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Used to determine limits on the size of the message 0N/A * that can be passed to <code>wrap</code>. Returns the maximum 0N/A * message size that, if presented to the <code>wrap</code> method with 0N/A * the same <code>confReq</code> and <code>qop</code> parameters, will 0N/A * result in an output token containing no more 0N/A * than <code>maxTokenSize</code> bytes.<p> 0N/A * This call is intended for use by applications that communicate over 0N/A * protocols that impose a maximum message size. It enables the 0N/A * application to fragment messages prior to applying protection.<p> 0N/A * GSS-API implementations are recommended but not required to detect 0N/A * invalid QOP values when <code>getWrapSizeLimit</code> is called. 0N/A * This routine guarantees only a maximum message size, not the 0N/A * availability of specific QOP values for message protection.<p> 0N/A * @param qop the level of protection wrap will be asked to provide. 0N/A * @param confReq <code>true</code> if wrap will be asked to provide 0N/A * privacy, <code>false</code> otherwise. 0N/A * @param maxTokenSize the desired maximum size of the token emitted by 0N/A * @return the maximum size of the input token for the given output 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED}, 0N/A * {@link GSSException#BAD_QOP GSSException.BAD_QOP}, 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Applies per-message security services over the established security 0N/A * context. The method will return a token with the 0N/A * application supplied data and a cryptographic MIC over it. 0N/A * The data may be encrypted if confidentiality (privacy) was 0N/A * The MessageProp object is instantiated by the application and used 0N/A * to specify a QOP value which selects cryptographic algorithms, and a 0N/A * privacy service to optionally encrypt the message. The underlying 0N/A * mechanism that is used in the call may not be able to provide the 0N/A * privacy service. It sets the actual privacy service that it does 0N/A * provide in this MessageProp object which the caller should then 0N/A * query upon return. If the mechanism is not able to provide the 0N/A * requested QOP, it throws a GSSException with the BAD_QOP code.<p> 0N/A * Since some application-level protocols may wish to use tokens 0N/A * emitted by wrap to provide "secure framing", implementations should 0N/A * support the wrapping of zero-length messages.<p> 0N/A * The application will be responsible for sending the token to the 0N/A * @param inBuf application data to be protected. 0N/A * @param offset the offset within the inBuf where the data begins. 0N/A * @param len the length of the data 0N/A * @param msgProp instance of MessageProp that is used by the 0N/A * application to set the desired QOP and privacy state. Set the 0N/A * desired QOP to 0 to request the default QOP. Upon return from this 0N/A * method, this object will contain the the actual privacy state that 0N/A * was applied to the message by the underlying mechanism. 0N/A * @return a byte[] containing the token to be sent to the peer. 0N/A * @throws GSSException containing the following major error codes: 0N/A * {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED}, 0N/A * {@link GSSException#BAD_QOP GSSException.BAD_QOP}, 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Applies per-message security services over the established security 0N/A * context using streams. The method will return a 0N/A * token with the application supplied data and a cryptographic MIC over it. 0N/A * The data may be encrypted if confidentiality 0N/A * (privacy) was requested. This method is equivalent to the byte array 0N/A * based {@link #wrap(byte[], int, int, MessageProp) wrap} method.<p> 0N/A * The application will be responsible for sending the token to the 0N/A * peer. Typically, the application would 0N/A * ensure this by calling the {@link java.io.OutputStream#flush() flush} 0N/A * method on an <code>OutputStream</code> that encapsulates the 0N/A * connection between the two peers.<p> 0N/A * The MessageProp object is instantiated by the application and used 0N/A * to specify a QOP value which selects cryptographic algorithms, and a 0N/A * privacy service to optionally encrypt the message. The underlying 0N/A * mechanism that is used in the call may not be able to provide the 0N/A * privacy service. It sets the actual privacy service that it does 0N/A * provide in this MessageProp object which the caller should then 0N/A * query upon return. If the mechanism is not able to provide the 0N/A * requested QOP, it throws a GSSException with the BAD_QOP code.<p> 0N/A * Since some application-level protocols may wish to use tokens 0N/A * emitted by wrap to provide "secure framing", implementations should 0N/A * support the wrapping of zero-length messages.<p> 0N/A * @param inStream an InputStream containing the application data to be 0N/A * protected. All of the data that is available in 0N/A * @param outStream an OutputStream to write the protected message 0N/A * @param msgProp instance of MessageProp that is used by the 0N/A * application to set the desired QOP and privacy state. Set the 0N/A * desired QOP to 0 to request the default QOP. Upon return from this 0N/A * method, this object will contain the the actual privacy state that 0N/A * was applied to the message by the underlying mechanism. 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED}, 0N/A * {@link GSSException#BAD_QOP GSSException.BAD_QOP}, 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Used to process tokens generated by the <code>wrap</code> method on 0N/A * the other side of the context. The method will return the message 0N/A * supplied by the peer application to its wrap call, while at the same 0N/A * time verifying the embedded MIC for that message.<p> 0N/A * The MessageProp object is instantiated by the application and is 0N/A * used by the underlying mechanism to return information to the caller 0N/A * such as the QOP, whether confidentiality was applied to the message, 0N/A * and other supplementary message state information.<p> 0N/A * Since some application-level protocols may wish to use tokens 0N/A * emitted by wrap to provide "secure framing", implementations should 0N/A * support the wrapping and unwrapping of zero-length messages.<p> 0N/A * @param inBuf a byte array containing the wrap token received from 0N/A * @param offset the offset where the token begins. 0N/A * @param len the length of the token 0N/A * @param msgProp upon return from the method, this object will contain 0N/A * the applied QOP, the privacy state of the message, and supplementary 0N/A * information stating if the token was a duplicate, old, out of 0N/A * sequence or arriving after a gap. 0N/A * @return a byte[] containing the message unwrapped from the input 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN}, 0N/A * {@link GSSException#BAD_MIC GSSException.BAD_MIC}, 0N/A * {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED}, 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Uses streams to process tokens generated by the <code>wrap</code> 0N/A * method on the other side of the context. The method will return the 0N/A * message supplied by the peer application to its wrap call, while at 0N/A * the same time verifying the embedded MIC for that message.<p> 0N/A * The MessageProp object is instantiated by the application and is 0N/A * used by the underlying mechanism to return information to the caller 0N/A * such as the QOP, whether confidentiality was applied to the message, 0N/A * and other supplementary message state information.<p> 0N/A * Since some application-level protocols may wish to use tokens 0N/A * emitted by wrap to provide "secure framing", implementations should 0N/A * support the wrapping and unwrapping of zero-length messages.<p> 0N/A * The format of the input token that this method 0N/A * reads is defined in the specification for the underlying mechanism that 0N/A * will be used. This method will attempt to read one of these tokens per 0N/A * invocation. If the mechanism token contains a definitive start and 0N/A * end this method may block on the <code>InputStream</code> if only 0N/A * part of the token is available. If the start and end of the token 0N/A * are not definitive then the method will attempt to treat all 0N/A * available bytes as part of the token.<p> 1941N/A * Other than the possible blocking behavior described above, this 0N/A * method is equivalent to the byte array based {@link #unwrap(byte[], 0N/A * int, int, MessageProp) unwrap} method.<p> 0N/A * @param inStream an InputStream that contains the wrap token generated 0N/A * @param outStream an OutputStream to write the application message 0N/A * @param msgProp upon return from the method, this object will contain 0N/A * the applied QOP, the privacy state of the message, and supplementary 0N/A * information stating if the token was a duplicate, old, out of 0N/A * sequence or arriving after a gap. 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN}, 0N/A * {@link GSSException#BAD_MIC GSSException.BAD_MIC}, 0N/A * {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED}, 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Returns a token containing a cryptographic Message Integrity Code 0N/A * (MIC) for the supplied message, for transfer to the peer 0N/A * application. Unlike wrap, which encapsulates the user message in the 0N/A * returned token, only the message MIC is returned in the output 0N/A * Note that privacy can only be applied through the wrap call.<p> 0N/A * Since some application-level protocols may wish to use tokens emitted 0N/A * by getMIC to provide "secure framing", implementations should support 0N/A * derivation of MICs from zero-length messages. 0N/A * @param inMsg the message to generate the MIC over. 0N/A * @param offset offset within the inMsg where the message begins. 0N/A * @param len the length of the message 0N/A * @param msgProp an instance of <code>MessageProp</code> that is used 0N/A * by the application to set the desired QOP. Set the desired QOP to 0N/A * <code>0</code> in <code>msgProp</code> to request the default 0N/A * QOP. Alternatively pass in <code>null</code> for <code>msgProp</code> 0N/A * to request the default QOP. 0N/A * @return a byte[] containing the token to be sent to the peer. 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED}, 0N/A * {@link GSSException#BAD_QOP GSSException.BAD_QOP}, 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Uses streams to produce a token containing a cryptographic MIC for 0N/A * the supplied message, for transfer to the peer application. 0N/A * Unlike wrap, which encapsulates the user message in the returned 0N/A * token, only the message MIC is produced in the output token. This 0N/A * method is equivalent to the byte array based {@link #getMIC(byte[], 0N/A * int, int, MessageProp) getMIC} method. 0N/A * Note that privacy can only be applied through the wrap call.<p> 0N/A * Since some application-level protocols may wish to use tokens emitted 0N/A * by getMIC to provide "secure framing", implementations should support 0N/A * derivation of MICs from zero-length messages. 0N/A * @param inStream an InputStream containing the message to generate the 0N/A * MIC over. All of the data that is available in 0N/A * @param outStream an OutputStream to write the output token to. 0N/A * @param msgProp an instance of <code>MessageProp</code> that is used 0N/A * by the application to set the desired QOP. Set the desired QOP to 0N/A * <code>0</code> in <code>msgProp</code> to request the default 0N/A * QOP. Alternatively pass in <code>null</code> for <code>msgProp</code> 0N/A * to request the default QOP. 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED}, 0N/A * {@link GSSException#BAD_QOP GSSException.BAD_QOP}, 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Verifies the cryptographic MIC, contained in the token parameter, 0N/A * over the supplied message.<p> 0N/A * The MessageProp object is instantiated by the application and is used 0N/A * by the underlying mechanism to return information to the caller such 0N/A * as the QOP indicating the strength of protection that was applied to 0N/A * the message and other supplementary message state information.<p> 0N/A * Since some application-level protocols may wish to use tokens emitted 0N/A * by getMIC to provide "secure framing", implementations should support 0N/A * the calculation and verification of MICs over zero-length messages. 0N/A * @param inToken the token generated by peer's getMIC method. 0N/A * @param tokOffset the offset within the inToken where the token 0N/A * @param tokLen the length of the token. 0N/A * @param inMsg the application message to verify the cryptographic MIC 0N/A * @param msgOffset the offset in inMsg where the message begins. 0N/A * @param msgLen the length of the message. 0N/A * @param msgProp upon return from the method, this object will contain 0N/A * the applied QOP and supplementary information stating if the token 0N/A * was a duplicate, old, out of sequence or arriving after a gap. 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN} 0N/A * {@link GSSException#BAD_MIC GSSException.BAD_MIC} 0N/A * {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED} 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Uses streams to verify the cryptographic MIC, contained in the token 0N/A * parameter, over the supplied message. This method is equivalent to 0N/A * the byte array based {@link #verifyMIC(byte[], int, int, byte[], int, 0N/A * int, MessageProp) verifyMIC} method. 0N/A * The MessageProp object is instantiated by the application and is used 0N/A * by the underlying mechanism to return information to the caller such 0N/A * as the QOP indicating the strength of protection that was applied to 0N/A * the message and other supplementary message state information.<p> 0N/A * Since some application-level protocols may wish to use tokens emitted 0N/A * by getMIC to provide "secure framing", implementations should support 0N/A * the calculation and verification of MICs over zero-length messages.<p> 0N/A * The format of the input token that this method 0N/A * reads is defined in the specification for the underlying mechanism that 0N/A * will be used. This method will attempt to read one of these tokens per 0N/A * invocation. If the mechanism token contains a definitive start and 0N/A * end this method may block on the <code>InputStream</code> if only 0N/A * part of the token is available. If the start and end of the token 0N/A * are not definitive then the method will attempt to treat all 0N/A * available bytes as part of the token.<p> 1941N/A * Other than the possible blocking behavior described above, this 0N/A * method is equivalent to the byte array based {@link #verifyMIC(byte[], 0N/A * int, int, byte[], int, int, MessageProp) verifyMIC} method.<p> 0N/A * @param tokStream an InputStream containing the token generated by the 0N/A * peer's getMIC method. 0N/A * @param msgStream an InputStream containing the application message to 0N/A * verify the cryptographic MIC over. All of the data 0N/A * that is available in msgStream is used. 0N/A * @param msgProp upon return from the method, this object will contain 0N/A * the applied QOP and supplementary information stating if the token 0N/A * was a duplicate, old, out of sequence or arriving after a gap. 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN} 0N/A * {@link GSSException#BAD_MIC GSSException.BAD_MIC} 0N/A * {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED} 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Exports this context so that another process may 0N/A * import it.. Provided to support the sharing of work between 0N/A * multiple processes. This routine will typically be used by the 0N/A * context-acceptor, in an application where a single process receives 0N/A * incoming connection requests and accepts security contexts over 0N/A * them, then passes the established context to one or more other 0N/A * processes for message exchange.<p> 0N/A * This method deactivates the security context and creates an 0N/A * interprocess token which, when passed to {@link 0N/A * GSSManager#createContext(byte[]) GSSManager.createContext} in 0N/A * another process, will re-activate the context in the second process. 0N/A * Only a single instantiation of a given context may be active at any 0N/A * one time; a subsequent attempt by a context exporter to access the 0N/A * exported security context will fail.<p> 0N/A * The implementation may constrain the set of processes by which the 0N/A * interprocess token may be imported, either as a function of local 0N/A * security policy, or as a result of implementation decisions. For 0N/A * example, some implementations may constrain contexts to be passed 0N/A * only between processes that run under the same account, or which are 0N/A * part of the same process group.<p> 0N/A * The interprocess token may contain security-sensitive information 0N/A * (for example cryptographic keys). While mechanisms are encouraged 0N/A * to either avoid placing such sensitive information within 0N/A * interprocess tokens, or to encrypt the token before returning it to 0N/A * the application, in a typical GSS-API implementation this may not be 0N/A * possible. Thus the application must take care to protect the 0N/A * interprocess token, and ensure that any process to which the token 0N/A * is transferred is trustworthy. <p> 0N/A * Implementations are not required to support the inter-process 0N/A * transfer of security contexts. Calling the {@link #isTransferable() 0N/A * isTransferable} method will indicate if the context object is 0N/A * Calling this method on a context that 0N/A * is not exportable will result in this exception being thrown with 0N/A * the error code {@link GSSException#UNAVAILABLE 0N/A * GSSException.UNAVAILABLE}. 0N/A * @return a byte[] containing the exported context 0N/A * @see GSSManager#createContext(byte[]) 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#UNAVAILABLE GSSException.UNAVAILABLE}, 0N/A * {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED}, 0N/A * {@link GSSException#NO_CONTEXT GSSException.NO_CONTEXT}, 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Requests that mutual authentication be done during 0N/A * context establishment. This request can only be made on the context 0N/A * initiator's side and it has to be done prior to the first call to 0N/A * <code>initSecContext</code>.<p> 0N/A * Not all mechanisms support mutual authentication and some mechanisms 0N/A * might require mutual authentication even if the application 0N/A * doesn't. Therefore, the application should check to see if the 0N/A * request was honored with the {@link #getMutualAuthState() 0N/A * getMutualAuthState} method.<p> 0N/A * @param state a boolean value indicating whether mutual 1941N/A * authentication should be used or not. 0N/A * @see #getMutualAuthState() 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Requests that replay detection be enabled for the 1941N/A * per-message security services after context establishment. This 0N/A * request can only be made on the context initiator's side and it has 0N/A * to be done prior to the first call to 0N/A * <code>initSecContext</code>. During context establishment replay 0N/A * detection is not an option and is a function of the underlying 0N/A * mechanism's capabilities.<p> 0N/A * Not all mechanisms support replay detection and some mechanisms 0N/A * might require replay detection even if the application 0N/A * doesn't. Therefore, the application should check to see if the 0N/A * request was honored with the {@link #getReplayDetState() 0N/A * getReplayDetState} method. If replay detection is enabled then the 0N/A * {@link MessageProp#isDuplicateToken() MessageProp.isDuplicateToken} and {@link 0N/A * MessageProp#isOldToken() MessageProp.isOldToken} methods will return 0N/A * valid results for the <code>MessageProp</code> object that is passed 0N/A * in to the <code>unwrap</code> method or the <code>verifyMIC</code> 0N/A * @param state a boolean value indicating whether replay detection 0N/A * should be enabled over the established context or not. 0N/A * @see #getReplayDetState() 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Requests that sequence checking be enabled for the 1941N/A * per-message security services after context establishment. This 0N/A * request can only be made on the context initiator's side and it has 0N/A * to be done prior to the first call to 0N/A * <code>initSecContext</code>. During context establishment sequence 0N/A * checking is not an option and is a function of the underlying 0N/A * mechanism's capabilities.<p> 0N/A * Not all mechanisms support sequence checking and some mechanisms 0N/A * might require sequence checking even if the application 0N/A * doesn't. Therefore, the application should check to see if the 0N/A * request was honored with the {@link #getSequenceDetState() 0N/A * getSequenceDetState} method. If sequence checking is enabled then the 0N/A * {@link MessageProp#isDuplicateToken() MessageProp.isDuplicateToken}, 0N/A * {@link MessageProp#isOldToken() MessageProp.isOldToken}, 0N/A * {@link MessageProp#isUnseqToken() MessageProp.isUnseqToken}, and 0N/A * {@link MessageProp#isGapToken() MessageProp.isGapToken} methods will return 0N/A * valid results for the <code>MessageProp</code> object that is passed 0N/A * in to the <code>unwrap</code> method or the <code>verifyMIC</code> 0N/A * @param state a boolean value indicating whether sequence checking 0N/A * should be enabled over the established context or not. 0N/A * @see #getSequenceDetState() 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Requests that the initiator's credentials be 0N/A * delegated to the acceptor during context establishment. This 0N/A * request can only be made on the context initiator's side and it has 0N/A * to be done prior to the first call to 0N/A * <code>initSecContext</code>. 0N/A * Not all mechanisms support credential delegation. Therefore, an 0N/A * application that desires delegation should check to see if the 0N/A * request was honored with the {@link #getCredDelegState() 0N/A * getCredDelegState} method. If the application indicates that 0N/A * delegation must not be used, then the mechanism will honor the 0N/A * request and delegation will not occur. This is an exception 0N/A * to the general rule that a mechanism may enable a service even if it 0N/A * is not requested.<p> 0N/A * @param state a boolean value indicating whether the credentials 0N/A * should be delegated or not. 0N/A * @see #getCredDelegState() 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Requests that the initiator's identity not be 0N/A * disclosed to the acceptor. This request can only be made on the 0N/A * context initiator's side and it has to be done prior to the first 0N/A * call to <code>initSecContext</code>. 0N/A * Not all mechanisms support anonymity for the initiator. Therefore, the 0N/A * application should check to see if the request was honored with the 0N/A * {@link #getAnonymityState() getAnonymityState} method.<p> 0N/A * @param state a boolean value indicating if the initiator should 0N/A * be authenticated to the acceptor as an anonymous principal. 0N/A * @see #getAnonymityState 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Requests that data confidentiality be enabled 0N/A * for the <code>wrap</code> method. This request can only be made on 0N/A * the context initiator's side and it has to be done prior to the 0N/A * first call to <code>initSecContext</code>. 0N/A * Not all mechanisms support confidentiality and other mechanisms 0N/A * might enable it even if the application doesn't request 0N/A * it. The application may check to see if the request was honored with 0N/A * the {@link #getConfState() getConfState} method. If confidentiality 0N/A * is enabled, only then will the mechanism honor a request for privacy 0N/A * in the {@link MessageProp#MessageProp(int, boolean) MessageProp} 0N/A * object that is passed in to the <code>wrap</code> method.<p> 0N/A * Enabling confidentiality will also automatically enable 0N/A * @param state a boolean value indicating whether confidentiality 0N/A * should be enabled or not. 0N/A * @see #getConfState() 0N/A * @see #getIntegState() 0N/A * @see #requestInteg(boolean) 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Requests that data integrity be enabled 0N/A * for the <code>wrap</code> and <code>getMIC</code>methods. This 0N/A * request can only be made on the context initiator's side and it has 0N/A * to be done prior to the first call to <code>initSecContext</code>. 0N/A * Not all mechanisms support integrity and other mechanisms 0N/A * might enable it even if the application doesn't request 0N/A * it. The application may check to see if the request was honored with 0N/A * the {@link #getIntegState() getIntegState} method.<p> 0N/A * Disabling integrity will also automatically disable 0N/A * confidentiality.<p> 0N/A * @param state a boolean value indicating whether integrity 0N/A * should be enabled or not. 0N/A * @see #getIntegState() 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Requests a lifetime in seconds for the 0N/A * context. This method can only be called on the context initiator's 0N/A * side and it has to be done prior to the first call to 0N/A * <code>initSecContext</code>.<p> 0N/A * The actual lifetime of the context will depend on the capabilites of 0N/A * the underlying mechanism and the application should call the {@link 0N/A * #getLifetime() getLifetime} method to determine this.<p> 0N/A * @param lifetime the desired context lifetime in seconds. Use 0N/A * <code>INDEFINITE_LIFETIME</code> to request an indefinite lifetime 0N/A * and <code>DEFAULT_LIFETIME</code> to request a default lifetime. 0N/A * @see #getLifetime() 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Sets the channel bindings to be used during context 0N/A * establishment. This method can be called on both 0N/A * the context initiator's and the context acceptor's side, but it must 0N/A * be called before context establishment begins. This means that an 0N/A * initiator must call it before the first call to 0N/A * <code>initSecContext</code> and the acceptor must call it before the 0N/A * first call to <code>acceptSecContext</code>. 0N/A * @param cb the channel bindings to use. 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Determines if credential delegation is enabled on 0N/A * this context. It can be called by both the context initiator and the 0N/A * context acceptor. For a definitive answer this method must be 0N/A * called only after context establishment is complete. Note that if an 0N/A * initiator requests that delegation not be allowed the {@link 0N/A * #requestCredDeleg(boolean) requestCredDeleg} method will honor that 0N/A * request and this method will return <code>false</code> on the 0N/A * initiator's side from that point onwards. <p> 0N/A * @return true if delegation is enabled, false otherwise. 0N/A * @see #requestCredDeleg(boolean) 0N/A * Determines if mutual authentication is enabled on 0N/A * this context. It can be called by both the context initiator and the 0N/A * context acceptor. For a definitive answer this method must be 0N/A * called only after context establishment is complete. An initiator 0N/A * that requests mutual authentication can call this method after 0N/A * context completion and dispose the context if its request was not 0N/A * @return true if mutual authentication is enabled, false otherwise. 0N/A * @see #requestMutualAuth(boolean) 0N/A * Determines if replay detection is enabled for the 0N/A * per-message security services from this context. It can be called by 0N/A * both the context initiator and the context acceptor. For a 0N/A * definitive answer this method must be called only after context 0N/A * establishment is complete. An initiator that requests replay 0N/A * detection can call this method after context completion and 0N/A * dispose the context if its request was not honored.<p> 0N/A * @return true if replay detection is enabled, false otherwise. 0N/A * @see #requestReplayDet(boolean) 0N/A * Determines if sequence checking is enabled for the 0N/A * per-message security services from this context. It can be called by 0N/A * both the context initiator and the context acceptor. For a 0N/A * definitive answer this method must be called only after context 0N/A * establishment is complete. An initiator that requests sequence 0N/A * checking can call this method after context completion and 0N/A * dispose the context if its request was not honored.<p> 0N/A * @return true if sequence checking is enabled, false otherwise. 0N/A * @see #requestSequenceDet(boolean) 0N/A * Determines if the context initiator is 0N/A * anonymously authenticated to the context acceptor. It can be called by 0N/A * both the context initiator and the context acceptor, and at any 0N/A * time. <strong>On the initiator side, a call to this method determines 0N/A * if the identity of the initiator has been disclosed in any of the 0N/A * context establishment tokens that might have been generated thus far 0N/A * by <code>initSecContext</code>. An initiator that absolutely must be 0N/A * authenticated anonymously should call this method after each call to 0N/A * <code>initSecContext</code> to determine if the generated token 0N/A * should be sent to the peer or the context aborted.</strong> On the 0N/A * acceptor side, a call to this method determines if any of the tokens 0N/A * processed by <code>acceptSecContext</code> thus far have divulged 0N/A * the identity of the initiator.<p> 0N/A * @return true if the context initiator is still anonymous, false 0N/A * @see #requestAnonymity(boolean) 0N/A * Determines if the context is transferable to other processes 0N/A * through the use of the {@link #export() export} method. This call 0N/A * is only valid on fully established contexts. 0N/A * @return true if this context can be exported, false otherwise. 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Determines if the context is ready for per message operations to be 0N/A * used over it. Some mechanisms may allow the usage of the 0N/A * per-message operations before the context is fully established. 0N/A * @return true if methods like <code>wrap</code>, <code>unwrap</code>, 0N/A * <code>getMIC</code>, and <code>verifyMIC</code> can be used with 0N/A * this context at the current stage of context establishment, false 0N/A * Determines if data confidentiality is available 0N/A * over the context. This method can be called by both the context 0N/A * initiator and the context acceptor, but only after one of {@link 0N/A * #isProtReady() isProtReady} or {@link #isEstablished() 0N/A * isEstablished} return <code>true</code>. If this method returns 0N/A * <code>true</code>, so will {@link #getIntegState() 0N/A * @return true if confidentiality services are available, false 0N/A * @see #requestConf(boolean) 0N/A * Determines if data integrity is available 0N/A * over the context. This method can be called by both the context 0N/A * initiator and the context acceptor, but only after one of {@link 0N/A * #isProtReady() isProtReady} or {@link #isEstablished() 0N/A * isEstablished} return <code>true</code>. This method will always 0N/A * return <code>true</code> if {@link #getConfState() getConfState} 0N/A * @return true if integrity services are available, false otherwise. 0N/A * @see #requestInteg(boolean) 0N/A * Determines what the remaining lifetime for this 0N/A * context is. It can be called by both the context initiator and the 0N/A * context acceptor, but for a definitive answer it should be called 0N/A * only after {@link #isEstablished() isEstablished} returns 0N/A * @return the remaining lifetime in seconds 0N/A * @see #requestLifetime(int) 0N/A * Returns the name of the context initiator. This call is valid only 0N/A * after one of {@link #isProtReady() isProtReady} or {@link 0N/A * #isEstablished() isEstablished} return <code>true</code>. 0N/A * @return a GSSName that is an MN containing the name of the context 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Returns the name of the context acceptor. This call is valid only 0N/A * after one of {@link #isProtReady() isProtReady} or {@link 0N/A * #isEstablished() isEstablished} return <code>true</code>. 0N/A * @return a GSSName that is an MN containing the name of the context 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Determines what mechanism is being used for this 0N/A * context. This method may be called before the context is fully 0N/A * established, but the mechanism returned may change on successive 0N/A * calls in the negotiated mechanism case. 0N/A * @return the Oid of the mechanism being used 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Obtains the credentials delegated by the context 0N/A * initiator to the context acceptor. It should be called only on the 0N/A * context acceptor's side, and once the context is fully 0N/A * established. The caller can use the method {@link 0N/A * #getCredDelegState() getCredDelegState} to determine if there are 0N/A * any delegated credentials. 0N/A * @return a GSSCredential containing the initiator's delegated 0N/A * credentials, or <code>null</code> is no credentials 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE} 0N/A * Determines if this is the context initiator. This 0N/A * can be called on both the context initiator's and context acceptor's 0N/A * @return true if this is the context initiator, false if it is the 0N/A * @throws GSSException containing the following 0N/A * major error codes: 0N/A * {@link GSSException#FAILURE GSSException.FAILURE}