jdk/src/share/classes/org/ietf/jgss/GSSContext.java
author malenkov
Tue, 29 Oct 2013 17:01:06 +0400
changeset 21278 ef8a3a2a72f2
parent 5506 202f599c92aa
child 23010 6dadb192ad81
permissions -rw-r--r--
8022746: List of spelling errors in API doc Reviewed-by: alexsch, smarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4336
diff changeset
     2
 * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4336
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4336
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4336
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4336
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4336
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package org.ietf.jgss;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import sun.security.jgss.spi.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.io.InputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.io.OutputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * This interface encapsulates the GSS-API security context and provides
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * the security services that are available over the context.  Security
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * contexts are established between peers using locally acquired
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * credentials.  Multiple contexts may exist simultaneously between a pair
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * of peers, using the same or different set of credentials.  GSS-API
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * functions in a manner independent of the underlying transport protocol
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * and depends on its calling application to transport the tokens that are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * generated by the security context between the peers.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * If the caller instantiates the context using the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <code>GSSManager</code> instance, then the Kerberos v5 GSS-API mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * is guaranteed to be available for context establishment. This mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * is identified by the Oid "1.2.840.113554.1.2.2" and is defined in RFC
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * 1964.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * Before the context establishment phase is initiated, the context
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * initiator may request specific characteristics desired of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * established context. Not all underlying mechanisms support all
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * characteristics that a caller might desire. After the context is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * established, the caller can check the actual characteristics and services
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * offered by that context by means of various query methods. When using
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * the Kerberos v5 GSS-API mechanism offered by the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * <code>GSSManager</code> instance, all optional services will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * available locally. They are mutual authentication, credential
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * delegation, confidentiality and integrity protection, and per-message
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * replay detection and sequencing. Note that in the GSS-API, message integrity
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * is a prerequisite for message confidentiality.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * The context establishment occurs in a loop where the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * initiator calls {@link #initSecContext(byte[], int, int) initSecContext}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * and the acceptor calls {@link #acceptSecContext(byte[], int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * acceptSecContext} until the context is established. While in this loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * the <code>initSecContext</code> and <code>acceptSecContext</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * methods produce tokens that the application sends over to the peer. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * peer passes any such token as input to its <code>acceptSecContext</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * or <code>initSecContext</code> as the case may be.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * During the context establishment phase, the {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * #isProtReady() isProtReady} method may be called to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * context can be used for the per-message operations of {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * #wrap(byte[], int, int, MessageProp) wrap} and {@link #getMIC(byte[],
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * int, int, MessageProp) getMIC}.  This allows applications to use
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * per-message operations on contexts which aren't yet fully
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * established.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * After the context has been established or the <code>isProtReady</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * method returns <code>true</code>, the query routines can be invoked to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * determine the actual characteristics and services of the established
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * context.  The application can also start using the per-message methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * of {@link #wrap(byte[], int, int, MessageProp) wrap} and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * {@link #getMIC(byte[], int, int, MessageProp) getMIC} to obtain
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * cryptographic operations on application supplied data.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * When the context is no longer needed, the application should call
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * {@link #dispose() dispose} to release any system resources the context
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * may be using.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * A security context typically maintains sequencing and replay detection
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * information about the tokens it processes. Therefore, the sequence in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * which any tokens are presented to this context for processing can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * important. Also note that none of the methods in this interface are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * synchronized. Therefore, it is not advisable to share a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * <code>GSSContext</code> among several threads unless some application
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * level synchronization is in place.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * Finally, different mechanism providers might place different security
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * restrictions on using GSS-API contexts. These will be documented by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * mechanism provider. The application will need to ensure that it has the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * appropriate permissions if such checks are made in the mechanism layer.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * The example code presented below demonstrates the usage of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 * <code>GSSContext</code> interface for the initiating peer.  Different
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * operations on the <code>GSSContext</code> object are presented,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 * including: object instantiation, setting of desired flags, context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 * establishment, query of actual context flags, per-message operations on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 * application data, and finally context deletion.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 *    // Create a context using default credentials
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 *    // and the implementation specific default mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 *    GSSManager manager ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 *    GSSName targetName ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 *    GSSContext context = manager.createContext(targetName, null, null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 *                                           GSSContext.INDEFINITE_LIFETIME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 *    // set desired context options prior to context establishment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 *    context.requestConf(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 *    context.requestMutualAuth(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 *    context.requestReplayDet(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 *    context.requestSequenceDet(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 *    // establish a context between peers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 *    byte []inToken = new byte[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 *    // Loop while there still is a token to be processed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 *    while (!context.isEstablished()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 *        byte[] outToken
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 *            = context.initSecContext(inToken, 0, inToken.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 *        // send the output token if generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 *        if (outToken != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 *            sendToken(outToken);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 *        if (!context.isEstablished()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 *            inToken = readToken();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 *    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 *     // display context information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 *     System.out.println("Remaining lifetime in seconds = "
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 *                                          + context.getLifetime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 *     System.out.println("Context mechanism = " + context.getMech());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 *     System.out.println("Initiator = " + context.getSrcName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
 *     System.out.println("Acceptor = " + context.getTargName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
 *     if (context.getConfState())
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 *             System.out.println("Confidentiality (i.e., privacy) is available");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 *     if (context.getIntegState())
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
 *             System.out.println("Integrity is available");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
 *     // perform wrap on an application supplied message, appMsg,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
 *     // using QOP = 0, and requesting privacy service
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
 *     byte [] appMsg ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
 *     MessageProp mProp = new MessageProp(0, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
 *     byte []tok = context.wrap(appMsg, 0, appMsg.length, mProp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
 *     sendToken(tok);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
 *     // release the local-end of the context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 *     context.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 * @author Mayank Upadhyay
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
 * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
public interface GSSContext {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * A lifetime constant representing the default context lifetime.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * value is set to 0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    public static final int DEFAULT_LIFETIME = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * A lifetime constant representing indefinite context lifetime.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * This value must is set to the maximum integer value in Java -
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * {@link java.lang.Integer#MAX_VALUE Integer.MAX_VALUE}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    public static final int INDEFINITE_LIFETIME = Integer.MAX_VALUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * Called by the context initiator to start the context creation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * phase and process any tokens generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * by the peer's <code>acceptSecContext</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * This method may return an output token which the application will need
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * to send to the peer for processing by its <code>acceptSecContext</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * method. The application can call {@link #isEstablished()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * isEstablished} to determine if the context establishment phase is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * complete on this side of the context.  A return value of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * <code>false</code> from <code>isEstablished</code> indicates that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * more tokens are expected to be supplied to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * <code>initSecContext</code>.  Upon completion of the context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * establishment, the available context options may be queried through
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * the get methods.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * Note that it is possible that the <code>initSecContext</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * return a token for the peer, and <code>isEstablished</code> return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * <code>true</code> also. This indicates that the token needs to be sent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * to the peer, but the local end of the context is now fully
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * established.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * Some mechanism providers might require that the caller be granted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * permission to initiate a security context. A failed permission check
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * might cause a {@link java.lang.SecurityException SecurityException}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * to be thrown from this method.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * @return a byte[] containing the token to be sent to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * peer. <code>null</code> indicates that no token is generated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * @param inputBuf token generated by the peer. This parameter is ignored
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * on the first call since no token has been received from the peer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * @param offset the offset within the inputBuf where the token begins.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * @param len the length of the token.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     *   {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     *   {@link GSSException#BAD_MIC GSSException.BAD_MIC},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     *   {@link GSSException#NO_CRED GSSException.NO_CRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     *   {@link GSSException#CREDENTIALS_EXPIRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     *                                  GSSException.CREDENTIALS_EXPIRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     *   {@link GSSException#BAD_BINDINGS GSSException.BAD_BINDINGS},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     *   {@link GSSException#OLD_TOKEN GSSException.OLD_TOKEN},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     *   {@link GSSException#DUPLICATE_TOKEN GSSException.DUPLICATE_TOKEN},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     *   {@link GSSException#BAD_NAMETYPE GSSException.BAD_NAMETYPE},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     *   {@link GSSException#BAD_MECH GSSException.BAD_MECH},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    public byte[] initSecContext(byte inputBuf[], int offset, int len)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * Called by the context initiator to start the context creation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * phase and process any tokens generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * by the peer's <code>acceptSecContext</code> method using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * streams. This method may write an output token to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * <code>OutpuStream</code>, which the application will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * need to send to the peer for processing by its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * <code>acceptSecContext</code> call. Typically, the application would
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * ensure this by calling the  {@link java.io.OutputStream#flush() flush}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * method on an <code>OutputStream</code> that encapsulates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * connection between the two peers. The application can
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * determine if a token is written to the OutputStream from the return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * value of this method. A return value of <code>0</code> indicates that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * no token was written. The application can call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * {@link #isEstablished() isEstablished} to determine if the context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * establishment phase is complete on this side of the context. A
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * return  value of <code>false</code> from <code>isEstablished</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * indicates that more tokens are expected to be supplied to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * <code>initSecContext</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * Upon completion of the context establishment, the available context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * options may be queried through the get methods.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * Note that it is possible that the <code>initSecContext</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * return a token for the peer, and <code>isEstablished</code> return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * <code>true</code> also. This indicates that the token needs to be sent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * to the peer, but the local end of the context is now fully
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * established.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * The GSS-API authentication tokens contain a definitive start and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * end. This method will attempt to read one of these tokens per
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * invocation, and may block on the stream if only part of the token is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * available.  In all other respects this method is equivalent to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * byte array based {@link #initSecContext(byte[], int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * initSecContext}.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * Some mechanism providers might require that the caller be granted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * permission to initiate a security context. A failed permission check
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * might cause a {@link java.lang.SecurityException SecurityException}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * to be thrown from this method.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * The following example code demonstrates how this method might be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * used:<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     *     InputStream is ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     *     OutputStream os ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     *     GSSContext context ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     *     // Loop while there is still a token to be processed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     *     while (!context.isEstablished()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     *         context.initSecContext(is, os);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     *         // send output token if generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     *         os.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * @return the number of bytes written to the OutputStream as part of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * token to be sent to the peer. A value of 0 indicates that no token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * needs to be sent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * @param inStream an InputStream that contains the token generated by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * the peer. This parameter is ignored on the first call since no token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * has been or will be received from the peer at that point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * @param outStream an OutputStream where the output token will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * written. During the final stage of context establishment, there may be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * no bytes written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     *   {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     *   {@link GSSException#BAD_MIC GSSException.BAD_MIC},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     *   {@link GSSException#NO_CRED GSSException.NO_CRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     *   {@link GSSException#CREDENTIALS_EXPIRED GSSException.CREDENTIALS_EXPIRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     *   {@link GSSException#BAD_BINDINGS GSSException.BAD_BINDINGS},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     *   {@link GSSException#OLD_TOKEN GSSException.OLD_TOKEN},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     *   {@link GSSException#DUPLICATE_TOKEN GSSException.DUPLICATE_TOKEN},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     *   {@link GSSException#BAD_NAMETYPE GSSException.BAD_NAMETYPE},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     *   {@link GSSException#BAD_MECH GSSException.BAD_MECH},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    public int initSecContext(InputStream inStream,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
                              OutputStream outStream) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * Called by the context acceptor upon receiving a token from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * peer. This method may return an output token which the application
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * will need to send to the peer for further processing by its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * <code>initSecContext</code> call.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * The application can call {@link #isEstablished() isEstablished} to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * determine if the context establishment phase is complete for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * peer.  A return value of <code>false</code> from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * <code>isEstablished</code> indicates that more tokens are expected to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * be supplied to this method.    Upon completion of the context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * establishment, the available context options may be queried through
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * the get methods.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * Note that it is possible that <code>acceptSecContext</code> return a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * token for the peer, and <code>isEstablished</code> return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * <code>true</code> also.  This indicates that the token needs to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * sent to the peer, but the local end of the context is now fully
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * established.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * Some mechanism providers might require that the caller be granted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * permission to accept a security context. A failed permission check
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * might cause a {@link java.lang.SecurityException SecurityException}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * to be thrown from this method.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * The following example code demonstrates how this method might be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * used:<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     *     byte[] inToken;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     *     byte[] outToken;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     *     GSSContext context ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     *     // Loop while there is still a token to be processed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     *     while (!context.isEstablished()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     *         inToken = readToken();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     *         outToken = context.acceptSecContext(inToken, 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     *                                             inToken.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     *         // send output token if generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     *         if (outToken != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     *             sendToken(outToken);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * @return a byte[] containing the token to be sent to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * peer. <code>null</code> indicates that no token is generated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * @param inToken token generated by the peer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     * @param offset the offset within the inToken where the token begins.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * @param len the length of the token.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     *   {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     *   {@link GSSException#BAD_MIC GSSException.BAD_MIC},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     *   {@link GSSException#NO_CRED GSSException.NO_CRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     *   {@link GSSException#CREDENTIALS_EXPIRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     *                               GSSException.CREDENTIALS_EXPIRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     *   {@link GSSException#BAD_BINDINGS GSSException.BAD_BINDINGS},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     *   {@link GSSException#OLD_TOKEN GSSException.OLD_TOKEN},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     *   {@link GSSException#DUPLICATE_TOKEN GSSException.DUPLICATE_TOKEN},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     *   {@link GSSException#BAD_MECH GSSException.BAD_MECH},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    public byte[] acceptSecContext(byte inToken[], int offset, int len)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * Called by the context acceptor to process a token from the peer using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * streams.   It may write an output token to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * <code>OutputStream</code>, which the application
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * will need to send to the peer for processing by its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * <code>initSecContext</code> method.  Typically, the application would
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * ensure this by calling the  {@link java.io.OutputStream#flush() flush}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * method on an <code>OutputStream</code> that encapsulates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * connection between the two peers. The application can call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * {@link #isEstablished() isEstablished} to determine if the context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * establishment phase is complete on this side of the context. A
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * return  value of <code>false</code> from <code>isEstablished</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * indicates that more tokens are expected to be supplied to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * <code>acceptSecContext</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * Upon completion of the context establishment, the available context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * options may be queried through the get methods.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     * Note that it is possible that <code>acceptSecContext</code> return a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * token for the peer, and <code>isEstablished</code> return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * <code>true</code> also.  This indicates that the token needs to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * sent to the peer, but the local end of the context is now fully
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * established.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * The GSS-API authentication tokens contain a definitive start and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * end. This method will attempt to read one of these tokens per
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * invocation, and may block on the stream if only part of the token is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * available. In all other respects this method is equivalent to the byte
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * array based {@link #acceptSecContext(byte[], int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * acceptSecContext}.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * Some mechanism providers might require that the caller be granted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * permission to accept a security context. A failed permission check
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * might cause a {@link java.lang.SecurityException SecurityException}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     * to be thrown from this method.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     * The following example code demonstrates how this method might be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * used:<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     *     InputStream is ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     *     OutputStream os ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     *     GSSContext context ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     *     // Loop while there is still a token to be processed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     *     while (!context.isEstablished()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     *         context.acceptSecContext(is, os);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     *         // send output token if generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     *         os.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     * @param inStream an InputStream that contains the token generated by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     * the peer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     * @param outStream an OutputStream where the output token will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     * written. During the final stage of context establishment, there may be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     * no bytes written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     *   {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     *   {@link GSSException#BAD_MIC GSSException.BAD_MIC},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     *   {@link GSSException#NO_CRED GSSException.NO_CRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     *   {@link GSSException#CREDENTIALS_EXPIRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
     *                           GSSException.CREDENTIALS_EXPIRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     *   {@link GSSException#BAD_BINDINGS GSSException.BAD_BINDINGS},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     *   {@link GSSException#OLD_TOKEN GSSException.OLD_TOKEN},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     *   {@link GSSException#DUPLICATE_TOKEN GSSException.DUPLICATE_TOKEN},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     *   {@link GSSException#BAD_MECH GSSException.BAD_MECH},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
    /* Missing return value in RFC. int should have been returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     * -----------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     * The application can determine if a token is written to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * OutputStream from the return value of this method. A return value of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     * <code>0</code> indicates that no token was written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     * @return <strong>the number of bytes written to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     * OutputStream as part of the token to be sent to the peer. A value of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     * 0 indicates that no token  needs to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     * sent.</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
    public void acceptSecContext(InputStream inStream,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
                                 OutputStream outStream) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
     * Used during context establishment to determine the state of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     * context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
     * @return <code>true</code> if this is a fully established context on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
     * the caller's side and no more tokens are needed from the peer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    public boolean isEstablished();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
     * Releases any system resources and cryptographic information stored in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
     * the context object and invalidates the context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
    public void dispose() throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
     * Used to determine limits on the size of the message
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
     * that can be passed to <code>wrap</code>. Returns the maximum
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
     * message size that, if presented to the <code>wrap</code> method with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
     * the same <code>confReq</code> and <code>qop</code> parameters, will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
     * result in an output token containing no more
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
     * than <code>maxTokenSize</code> bytes.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
     * This call is intended for use by applications that communicate over
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
     * protocols that impose a maximum message size.  It enables the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
     * application to fragment messages prior to applying protection.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
     * GSS-API implementations are recommended but not required to detect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
     * invalid QOP values when <code>getWrapSizeLimit</code> is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     * This routine guarantees only a maximum message size, not the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     * availability of specific QOP values for message protection.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     * @param qop the level of protection wrap will be asked to provide.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
     * @param confReq <code>true</code> if wrap will be asked to provide
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
     * privacy, <code>false</code>  otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
     * @param maxTokenSize the desired maximum size of the token emitted by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
     * wrap.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
     * @return the maximum size of the input token for the given output
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
     * token size
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
     *   {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
     *   {@link GSSException#BAD_QOP GSSException.BAD_QOP},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
    public int getWrapSizeLimit(int qop, boolean confReq,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
                                int maxTokenSize) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
     * Applies per-message security services over the established security
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     * context. The method will return a token with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     * application supplied data and a cryptographic MIC over it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     * The data may be encrypted if confidentiality (privacy) was
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     * requested.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
     * The MessageProp object is instantiated by the application and used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
     * to specify a QOP value which selects cryptographic algorithms, and a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
     * privacy service to optionally encrypt the message.  The underlying
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     * mechanism that is used in the call may not be able to provide the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
     * privacy service.  It sets the actual privacy service that it does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
     * provide in this MessageProp object which the caller should then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
     * query upon return.  If the mechanism is not able to provide the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
     * requested QOP, it throws a GSSException with the BAD_QOP code.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
     * Since some application-level protocols may wish to use tokens
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
     * emitted by wrap to provide "secure framing", implementations should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
     * support the wrapping of zero-length messages.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
     * The application will be responsible for sending the token to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
     * peer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
     * @param inBuf application data to be protected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
     * @param offset the offset within the inBuf where the data begins.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
     * @param len the length of the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
     * @param msgProp instance of MessageProp that is used by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
     * application to set the desired QOP and privacy state. Set the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
     * desired QOP to 0 to request the default QOP. Upon return from this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
     * method, this object will contain the the actual privacy state that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
     * was applied to the message by the underlying mechanism.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
     * @return a byte[] containing the token to be sent to the peer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
     * @throws GSSException containing the following major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
     *   {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
     *   {@link GSSException#BAD_QOP GSSException.BAD_QOP},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
    public byte[] wrap(byte inBuf[], int offset, int len,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
                       MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
     * Applies per-message security services over the established security
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
     * context using streams. The method will return a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
     * token with the application supplied data and a cryptographic MIC over it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
     * The data may be encrypted if confidentiality
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
     * (privacy) was requested. This method is equivalent to the byte array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
     * based {@link #wrap(byte[], int, int, MessageProp) wrap} method.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
     * The application will be responsible for sending the token to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
     * peer.  Typically, the application would
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
     * ensure this by calling the  {@link java.io.OutputStream#flush() flush}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
     * method on an <code>OutputStream</code> that encapsulates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
     * connection between the two peers.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
     * The MessageProp object is instantiated by the application and used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
     * to specify a QOP value which selects cryptographic algorithms, and a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
     * privacy service to optionally encrypt the message.  The underlying
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
     * mechanism that is used in the call may not be able to provide the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
     * privacy service.  It sets the actual privacy service that it does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
     * provide in this MessageProp object which the caller should then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
     * query upon return.  If the mechanism is not able to provide the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
     * requested QOP, it throws a GSSException with the BAD_QOP code.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     * Since some application-level protocols may wish to use tokens
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     * emitted by wrap to provide "secure framing", implementations should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     * support the wrapping of zero-length messages.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
     * @param inStream an InputStream containing the application data to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
     * protected. All of the data that is available in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
     * inStream is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
     * @param outStream an OutputStream to write the protected message
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
     * to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
     * @param msgProp instance of MessageProp that is used by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
     * application to set the desired QOP and privacy state. Set the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
     * desired QOP to 0 to request the default QOP. Upon return from this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
     * method, this object will contain the the actual privacy state that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
     * was applied to the message by the underlying mechanism.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
     *   {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
     *   {@link GSSException#BAD_QOP GSSException.BAD_QOP},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
    public void wrap(InputStream inStream, OutputStream outStream,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
                     MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
     * Used to process tokens generated by the <code>wrap</code> method on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
     * the other side of the context. The method will return the message
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
     * supplied by the peer application to its wrap call, while at the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
     * time verifying the embedded MIC for that message.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
     * The MessageProp object is instantiated by the application and is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
     * used by the underlying mechanism to return information to the caller
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
     * such as the QOP, whether confidentiality was applied to the message,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     * and other supplementary message state information.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
     * Since some application-level protocols may wish to use tokens
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
     * emitted by wrap to provide "secure framing", implementations should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
     * support the wrapping and unwrapping of zero-length messages.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
     * @param inBuf a byte array containing the wrap token received from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
     * peer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
     * @param offset the offset where the token begins.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
     * @param len the length of the token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
     * @param msgProp upon return from the method, this object will contain
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
     * the applied QOP, the privacy state of the message, and supplementary
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
     * information stating if the token was a duplicate, old, out of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
     * sequence or arriving after a gap.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
     * @return a byte[] containing the message unwrapped from the input
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
     * token.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
     *   {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
     *   {@link GSSException#BAD_MIC GSSException.BAD_MIC},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
     *   {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
    public byte [] unwrap(byte[] inBuf, int offset, int len,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
                          MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
     * Uses streams to process tokens generated by the <code>wrap</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
     * method on the other side of the context. The method will return the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
     * message supplied by the peer application to its wrap call, while at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
     * the same time verifying the embedded MIC for that message.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
     * The MessageProp object is instantiated by the application and is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
     * used by the underlying mechanism to return information to the caller
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
     * such as the QOP, whether confidentiality was applied to the message,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
     * and other supplementary message state information.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
     * Since some application-level protocols may wish to use tokens
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
     * emitted by wrap to provide "secure framing", implementations should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
     * support the wrapping and unwrapping of zero-length messages.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
     * The format of the input token that this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
     * reads is defined in the specification for the underlying mechanism that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
     * will be used. This method will attempt to read one of these tokens per
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
     * invocation. If the mechanism token contains a definitive start and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
     * end this method may block on the <code>InputStream</code> if only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
     * part of the token is available. If the start and end of the token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
     * are not definitive then the method will attempt to treat all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
     * available bytes as part of the token.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
     *
4336
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents: 2
diff changeset
   681
     * Other than the possible blocking behavior described above, this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
     * method is equivalent to the byte array based {@link #unwrap(byte[],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
     * int, int, MessageProp) unwrap} method.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
     * @param inStream an InputStream that contains the wrap token generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
     * by the peer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
     * @param outStream an OutputStream to write the application message
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
     * to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
     * @param msgProp upon return from the method, this object will contain
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
     * the applied QOP, the privacy state of the message, and supplementary
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
     * information stating if the token was a duplicate, old, out of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
     * sequence or arriving after a gap.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
     *   {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
     *   {@link GSSException#BAD_MIC GSSException.BAD_MIC},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
     *   {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
    public void unwrap(InputStream inStream, OutputStream outStream,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
                       MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
     * Returns a token containing a cryptographic Message Integrity Code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
     * (MIC) for the supplied message,  for transfer to the peer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
     * application.  Unlike wrap, which encapsulates the user message in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
     * returned token, only the message MIC is returned in the output
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
     * token.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
     * Note that privacy can only be applied through the wrap call.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
     * Since some application-level protocols may wish to use tokens emitted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
     * by getMIC to provide "secure framing", implementations should support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
     * derivation of MICs from zero-length messages.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
     * @param inMsg the message to generate the MIC over.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
     * @param offset offset within the inMsg where the message begins.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
     * @param len the length of the message
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
     * @param msgProp an instance of <code>MessageProp</code> that is used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
     * by the application to set the desired QOP.  Set the desired QOP to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
     * <code>0</code> in <code>msgProp</code> to request the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
     * QOP. Alternatively pass in <code>null</code> for <code>msgProp</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
     * to request the default QOP.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
     * @return a byte[] containing the token to be sent to the peer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
     *   {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
     *   {@link GSSException#BAD_QOP GSSException.BAD_QOP},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
    public byte[] getMIC(byte []inMsg, int offset, int len,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
                         MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
     * Uses streams to produce a token containing a cryptographic MIC for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
     * the supplied message, for transfer to the peer application.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
     * Unlike wrap, which encapsulates the user message in the returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
     * token, only the message MIC is produced in the output token. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
     * method is equivalent to the byte array based {@link #getMIC(byte[],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
     * int, int, MessageProp) getMIC} method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
     * Note that privacy can only be applied through the wrap call.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
     * Since some application-level protocols may wish to use tokens emitted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
     * by getMIC to provide "secure framing", implementations should support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
     * derivation of MICs from zero-length messages.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
     * @param inStream an InputStream containing the message to generate the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
     * MIC over. All of the data that is available in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
     * inStream is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
     * @param outStream an OutputStream to write the output token to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
     * @param msgProp an instance of <code>MessageProp</code> that is used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
     * by the application to set the desired QOP.  Set the desired QOP to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
     * <code>0</code> in <code>msgProp</code> to request the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
     * QOP. Alternatively pass in <code>null</code> for <code>msgProp</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
     * to request the default QOP.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
     *   {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
     *   {@link GSSException#BAD_QOP GSSException.BAD_QOP},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
    public void getMIC(InputStream inStream, OutputStream outStream,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
                       MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
     * Verifies the cryptographic MIC, contained in the token parameter,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
     * over the supplied message.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
     * The MessageProp object is instantiated by the application and is used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
     * by the underlying mechanism to return information to the caller such
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
     * as the QOP indicating the strength of protection that was applied to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
     * the message and other supplementary message state information.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
     * Since some application-level protocols may wish to use tokens emitted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
     * by getMIC to provide "secure framing", implementations should support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
     * the calculation and verification of MICs over zero-length messages.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
     * @param inToken the token generated by peer's getMIC method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
     * @param tokOffset the offset within the inToken where the token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
     * begins.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
     * @param tokLen the length of the token.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
     * @param inMsg the application message to verify the cryptographic MIC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
     * over.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
     * @param msgOffset the offset in inMsg where the message begins.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
     * @param msgLen the length of the message.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
     * @param msgProp upon return from the method, this object will contain
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
     * the applied QOP and supplementary information stating if the token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
     * was a duplicate, old, out of sequence or arriving after a gap.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
     *   {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
     *   {@link GSSException#BAD_MIC GSSException.BAD_MIC}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
     *   {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
    public void verifyMIC(byte[] inToken, int tokOffset, int tokLen,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
                          byte[] inMsg, int msgOffset, int msgLen,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
                          MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
     * Uses streams to verify the cryptographic MIC, contained in the token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
     * parameter, over the supplied message.  This method is equivalent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
     * the byte array based {@link #verifyMIC(byte[], int, int, byte[], int,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
     * int, MessageProp) verifyMIC} method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
     * The MessageProp object is instantiated by the application and is used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
     * by the underlying mechanism to return information to the caller such
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
     * as the QOP indicating the strength of protection that was applied to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
     * the message and other supplementary message state information.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
     * Since some application-level protocols may wish to use tokens emitted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
     * by getMIC to provide "secure framing", implementations should support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
     * the calculation and verification of MICs over zero-length messages.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
     * The format of the input token that this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
     * reads is defined in the specification for the underlying mechanism that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
     * will be used. This method will attempt to read one of these tokens per
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
     * invocation. If the mechanism token contains a definitive start and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
     * end this method may block on the <code>InputStream</code> if only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
     * part of the token is available. If the start and end of the token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
     * are not definitive then the method will attempt to treat all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
     * available bytes as part of the token.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
     *
4336
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents: 2
diff changeset
   829
     * Other than the possible blocking behavior described above, this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
     * method is equivalent to the byte array based {@link #verifyMIC(byte[],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
     * int, int, byte[], int, int, MessageProp) verifyMIC} method.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
     * @param tokStream an InputStream containing the token generated by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
     * peer's getMIC method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
     * @param msgStream an InputStream containing the application message to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
     * verify the cryptographic MIC over. All of the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
     * that is available in msgStream is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
     * @param msgProp upon return from the method, this object will contain
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
     * the applied QOP and supplementary information stating if the token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
     * was a duplicate, old, out of sequence or arriving after a gap.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
     *   {@link GSSException#DEFECTIVE_TOKEN GSSException.DEFECTIVE_TOKEN}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
     *   {@link GSSException#BAD_MIC GSSException.BAD_MIC}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
     *   {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
    public void verifyMIC(InputStream tokStream, InputStream msgStream,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
                          MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
     * Exports this context so that another process may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
     * import it.. Provided to support the sharing of work between
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
     * multiple processes. This routine will typically be used by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
     * context-acceptor, in an application where a single process receives
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
     * incoming connection requests and accepts security contexts over
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
     * them, then passes the established context to one or more other
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
     * processes for message exchange.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
     * This method deactivates the security context and creates an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
     * interprocess token which, when passed to {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
     * GSSManager#createContext(byte[]) GSSManager.createContext} in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
     * another process, will re-activate the context in the second process.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
     * Only a single instantiation of a given context may be active at any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
     * one time; a subsequent attempt by a context exporter to access the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
     * exported security context will fail.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
     * The implementation may constrain the set of processes by which the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
     * interprocess token may be imported, either as a function of local
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
     * security policy, or as a result of implementation decisions.  For
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
     * example, some implementations may constrain contexts to be passed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
     * only between processes that run under the same account, or which are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
     * part of the same process group.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
     * The interprocess token may contain security-sensitive information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
     * (for example cryptographic keys).  While mechanisms are encouraged
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
     * to either avoid placing such sensitive information within
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
     * interprocess tokens, or to encrypt the token before returning it to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
     * the application, in a typical GSS-API implementation this may not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
     * possible.  Thus the application must take care to protect the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
     * interprocess token, and ensure that any process to which the token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
     * is transferred is trustworthy. <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
     * Implementations are not required to support the inter-process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
     * transfer of security contexts.  Calling the {@link #isTransferable()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
     * isTransferable} method will indicate if the context object is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
     * transferable.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
     * Calling this method on a context that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
     * is not exportable will result in this exception being thrown with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
     * the error code {@link GSSException#UNAVAILABLE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
     * GSSException.UNAVAILABLE}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
     * @return a byte[] containing the exported context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
     * @see GSSManager#createContext(byte[])
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
     *   {@link GSSException#UNAVAILABLE GSSException.UNAVAILABLE},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
     *   {@link GSSException#CONTEXT_EXPIRED GSSException.CONTEXT_EXPIRED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
     *   {@link GSSException#NO_CONTEXT GSSException.NO_CONTEXT},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
    public byte [] export() throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
     * Requests that mutual authentication be done during
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
     * context establishment. This request can only be made on the context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
     * initiator's side and it has to be done prior to the first call to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
     * <code>initSecContext</code>.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
     * Not all mechanisms support mutual authentication and some mechanisms
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
     * might require mutual authentication even if the application
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
     * doesn't. Therefore, the application should check to see if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
     * request was honored with the {@link #getMutualAuthState()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
     * getMutualAuthState} method.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
     * @param state a boolean value indicating whether mutual
4336
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents: 2
diff changeset
   920
     * authentication should be used or not.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
     * @see #getMutualAuthState()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
    public void requestMutualAuth(boolean state) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
     * Requests that replay detection be enabled for the
4336
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents: 2
diff changeset
   931
     * per-message security services after context establishment. This
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
     * request can only be made on the context initiator's side and it has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
     * to be done prior to the first call to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
     * <code>initSecContext</code>. During context establishment replay
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
     * detection is not an option and is a function of the underlying
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
     * mechanism's capabilities.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
     * Not all mechanisms support replay detection and some mechanisms
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
     * might require replay detection even if the application
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
     * doesn't. Therefore, the application should check to see if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
     * request was honored with the {@link #getReplayDetState()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
     * getReplayDetState} method. If replay detection is enabled then the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
     * {@link MessageProp#isDuplicateToken() MessageProp.isDuplicateToken} and {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
     * MessageProp#isOldToken() MessageProp.isOldToken} methods will return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
     * valid results for the <code>MessageProp</code> object that is passed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
     * in to the <code>unwrap</code> method or the <code>verifyMIC</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
     * method.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
     * @param state a boolean value indicating whether replay detection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
     * should be enabled over the established context or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
     * @see #getReplayDetState()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
    public void requestReplayDet(boolean state) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
     * Requests that sequence checking be enabled for the
4336
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents: 2
diff changeset
   961
     * per-message security services after context establishment. This
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
     * request can only be made on the context initiator's side and it has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
     * to be done prior to the first call to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
     * <code>initSecContext</code>. During context establishment sequence
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
     * checking is not an option and is a function of the underlying
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
     * mechanism's capabilities.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
     * Not all mechanisms support sequence checking and some mechanisms
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
     * might require sequence checking even if the application
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
     * doesn't. Therefore, the application should check to see if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
     * request was honored with the {@link #getSequenceDetState()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
     * getSequenceDetState} method. If sequence checking is enabled then the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
     * {@link MessageProp#isDuplicateToken() MessageProp.isDuplicateToken},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
     * {@link MessageProp#isOldToken() MessageProp.isOldToken},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
     * {@link MessageProp#isUnseqToken() MessageProp.isUnseqToken}, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
     * {@link MessageProp#isGapToken() MessageProp.isGapToken} methods will return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
     * valid results for the <code>MessageProp</code> object that is passed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
     * in to the <code>unwrap</code> method or the <code>verifyMIC</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
     * method.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
     * @param state a boolean value indicating whether sequence checking
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
     * should be enabled over the established context or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
     * @see #getSequenceDetState()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
    public void requestSequenceDet(boolean state) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
     * Requests that the initiator's credentials be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
     * delegated to the acceptor during context establishment. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
     * request can only be made on the context initiator's side and it has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
     * to be done prior to the first call to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
     * <code>initSecContext</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
     * Not all mechanisms support credential delegation. Therefore, an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
     * application that desires delegation should check to see if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
     * request was honored with the {@link #getCredDelegState()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
     * getCredDelegState} method. If the application indicates that
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
     * delegation must not be used, then the mechanism will honor the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
     * request and delegation will not occur. This is an exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
     * to the general rule that a mechanism may enable a service even if it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
     * is not requested.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
     * @param state a boolean value indicating whether the credentials
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
     * should be delegated or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
     * @see #getCredDelegState()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
    public void requestCredDeleg(boolean state) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
     * Requests that the initiator's identity not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
     * disclosed to the acceptor. This request can only be made on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
     * context initiator's side and it has to be done prior to the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
     * call to <code>initSecContext</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
     * Not all mechanisms support anonymity for the initiator. Therefore, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
     * application should check to see if the request was honored with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
     * {@link #getAnonymityState() getAnonymityState} method.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
     * @param state a boolean value indicating if the initiator should
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
     * be authenticated to the acceptor as an anonymous principal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
     * @see #getAnonymityState
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
    public void requestAnonymity(boolean state) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
     * Requests that data confidentiality be enabled
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
     * for the <code>wrap</code> method. This request can only be made on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
     * the context initiator's side and it has to be done prior to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
     * first call to <code>initSecContext</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
     * Not all mechanisms support confidentiality and other mechanisms
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
     * might enable it even if the application doesn't request
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
     * it. The application may check to see if the request was honored with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
     * the {@link #getConfState() getConfState} method. If confidentiality
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
     * is enabled, only then will the mechanism honor a request for privacy
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
     * in the {@link MessageProp#MessageProp(int, boolean) MessageProp}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
     * object that is passed in to the <code>wrap</code> method.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
     * Enabling confidentiality will also automatically enable
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
     * integrity.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
     * @param state a boolean value indicating whether confidentiality
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
     * should be enabled or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
     * @see #getConfState()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
     * @see #getIntegState()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
     * @see #requestInteg(boolean)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
     * @see MessageProp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
    public void requestConf(boolean state) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
     * Requests that data integrity be enabled
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
     * for the <code>wrap</code> and <code>getMIC</code>methods. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
     * request can only be made on the context initiator's side and it has
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
     * to be done prior to the first call to <code>initSecContext</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
     * Not all mechanisms support integrity and other mechanisms
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
     * might enable it even if the application doesn't request
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
     * it. The application may check to see if the request was honored with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
     * the {@link #getIntegState() getIntegState} method.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
     * Disabling integrity will also automatically disable
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
     * confidentiality.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
     * @param state a boolean value indicating whether integrity
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
     * should be enabled or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
     * @see #getIntegState()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
    public void requestInteg(boolean state) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
     * Requests a lifetime in seconds for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
     * context. This method can only be called on the context initiator's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
     * side  and it has to be done prior to the first call to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
     * <code>initSecContext</code>.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
     *
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 5506
diff changeset
  1097
     * The actual lifetime of the context will depend on the capabilities of
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
     * the underlying mechanism and the application should call the {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
     * #getLifetime() getLifetime} method to determine this.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
     * @param lifetime the desired context lifetime in seconds. Use
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
     * <code>INDEFINITE_LIFETIME</code> to request an indefinite lifetime
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
     * and <code>DEFAULT_LIFETIME</code> to request a default lifetime.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
     * @see #getLifetime()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
    public void requestLifetime(int lifetime) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
     * Sets the channel bindings to be used during context
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
     * establishment. This method can be called on both
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
     * the context initiator's and the context acceptor's side, but it must
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
     * be called before context establishment begins. This means that an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
     * initiator must call it before the first call to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
     * <code>initSecContext</code> and the acceptor must call it before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
     * first call to <code>acceptSecContext</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
     * @param cb the channel bindings to use.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
    public void setChannelBinding(ChannelBinding cb) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
     * Determines if credential delegation is enabled on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
     * this context. It can be called by both the context initiator and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
     * context acceptor. For a definitive answer this method must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
     * called only after context establishment is complete. Note that if an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
     * initiator requests that delegation not be allowed the {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
     * #requestCredDeleg(boolean) requestCredDeleg} method will honor that
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
     * request and this method will return <code>false</code> on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
     * initiator's side from that point onwards. <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
     * @return true if delegation is enabled, false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
     * @see #requestCredDeleg(boolean)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
    public boolean getCredDelegState();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
     * Determines if mutual authentication is enabled on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
     * this context. It can be called by both the context initiator and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
     * context acceptor. For a definitive answer this method must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
     * called only after context establishment is complete. An initiator
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
     * that requests mutual authentication can call this method after
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
     * context completion and dispose the context if its request was not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
     * honored.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
     * @return true if mutual authentication is enabled, false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
     * @see #requestMutualAuth(boolean)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
    public boolean getMutualAuthState();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
     * Determines if replay detection is enabled for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
     * per-message security services from this context. It can be called by
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
     * both the context initiator and the context acceptor. For a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
     * definitive answer this method must be called only after context
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
     * establishment is complete. An initiator that requests replay
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
     * detection can call this method after context completion and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
     * dispose the context if its request was not honored.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
     * @return true if replay detection is enabled, false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
     * @see #requestReplayDet(boolean)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
    public boolean getReplayDetState();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
     * Determines if sequence checking is enabled for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
     * per-message security services from this context. It can be called by
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
     * both the context initiator and the context acceptor. For a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
     * definitive answer this method must be called only after context
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
     * establishment is complete. An initiator that requests sequence
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
     * checking can call this method after context completion and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
     * dispose the context if its request was not honored.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
     * @return true if sequence checking is enabled, false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
     * @see #requestSequenceDet(boolean)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
    public boolean getSequenceDetState();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
     * Determines if the context initiator is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
     * anonymously authenticated to the context acceptor. It can be called by
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
     * both the context initiator and the context acceptor, and at any
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
     * time. <strong>On the initiator side, a call to this method determines
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
     * if the identity of the initiator has been disclosed in any of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
     * context establishment tokens that might have been generated thus far
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
     * by <code>initSecContext</code>. An initiator that absolutely must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
     * authenticated anonymously should call this method after each call to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
     * <code>initSecContext</code> to determine if the generated token
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
     * should be sent to the peer or the context aborted.</strong> On the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
     * acceptor side, a call to this method determines if any of the tokens
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
     * processed by <code>acceptSecContext</code> thus far have divulged
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
     * the identity of the initiator.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
     * @return true if the context initiator is still anonymous, false
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
     * otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
     * @see #requestAnonymity(boolean)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
    public boolean getAnonymityState();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
     * Determines if the context is transferable to other processes
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
     * through the use of the {@link #export() export} method.  This call
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
     * is only valid on fully established contexts.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1212
     * @return true if this context can be exported, false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1213
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
    public boolean isTransferable() throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
     * Determines if the context is ready for per message operations to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
     * used over it.  Some mechanisms may allow the usage of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1223
     * per-message operations before the context is fully established.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1225
     * @return true if methods like <code>wrap</code>, <code>unwrap</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
     * <code>getMIC</code>, and <code>verifyMIC</code> can be used with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1227
     * this context at the current stage of context establishment, false
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1228
     * otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1229
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
    public boolean isProtReady();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1231
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
     * Determines if data confidentiality is available
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1234
     * over the context. This method can be called by both the context
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1235
     * initiator and the context acceptor, but only after one of {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
     * #isProtReady() isProtReady} or {@link #isEstablished()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1237
     * isEstablished} return <code>true</code>. If this method returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
     * <code>true</code>, so will {@link #getIntegState()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1239
     * getIntegState}<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1240
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
     * @return true if confidentiality services are available, false
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1242
     * otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
     * @see #requestConf(boolean)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1244
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
    public boolean getConfState();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1246
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
     * Determines if data integrity is available
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1249
     * over the context. This method can be called by both the context
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250
     * initiator and the context acceptor, but only after one of {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1251
     * #isProtReady() isProtReady} or {@link #isEstablished()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1252
     * isEstablished} return <code>true</code>. This method will always
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1253
     * return <code>true</code> if {@link #getConfState() getConfState}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1254
     * returns true.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1255
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1256
     * @return true if integrity services are available, false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1257
     * @see #requestInteg(boolean)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1258
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1259
    public boolean getIntegState();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1260
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1261
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1262
     * Determines what the remaining lifetime for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1263
     * context is. It can be called by both the context initiator and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1264
     * context acceptor, but for a definitive answer it should be called
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1265
     * only after {@link #isEstablished() isEstablished} returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1266
     * true.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1267
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1268
     * @return the remaining lifetime in seconds
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1269
     * @see #requestLifetime(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1270
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1271
    public int getLifetime();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1272
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1273
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1274
     * Returns the name of the context initiator. This call is valid only
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1275
     * after one of {@link #isProtReady() isProtReady} or {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1276
     * #isEstablished() isEstablished} return <code>true</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1277
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1278
     * @return a GSSName that is an MN containing the name of the context
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1279
     * initiator.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1280
     * @see GSSName
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1281
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1282
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1283
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1284
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1285
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1286
    public GSSName getSrcName() throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1287
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1288
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1289
     * Returns the name of the context acceptor. This call is valid only
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1290
     * after one of {@link #isProtReady() isProtReady} or {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1291
     * #isEstablished() isEstablished} return <code>true</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1292
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1293
     * @return a GSSName that is an MN containing the name of the context
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1294
     * acceptor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1295
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1296
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1297
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1298
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1299
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1300
    public GSSName getTargName() throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1301
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1302
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1303
     * Determines what mechanism is being used for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1304
     * context. This method may be called before the context is fully
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1305
     * established, but the mechanism returned may change on successive
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1306
     * calls in the negotiated mechanism case.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1307
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1308
     * @return the Oid of the mechanism being used
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1309
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1310
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1311
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1312
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1313
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1314
    public Oid getMech() throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1315
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1316
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1317
     * Obtains the credentials delegated by the context
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1318
     * initiator to the context acceptor. It should be called only on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1319
     * context acceptor's side, and once the context is fully
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1320
     * established. The caller can use the method {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1321
     * #getCredDelegState() getCredDelegState} to determine if there are
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1322
     * any delegated credentials.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1323
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1324
     * @return a GSSCredential containing the initiator's delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1325
     * credentials, or <code>null</code> is no credentials
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1326
     * were delegated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1327
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1328
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1329
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1330
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1331
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1332
    public GSSCredential getDelegCred() throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1333
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1334
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1335
     * Determines if this is the context initiator. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1336
     * can be called on both the context initiator's and context acceptor's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1337
     * side.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1338
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1339
     * @return true if this is the context initiator, false if it is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1340
     * context acceptor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1341
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1342
     * @throws GSSException containing the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1343
     * major error codes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1344
     *   {@link GSSException#FAILURE GSSException.FAILURE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1345
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1346
    public boolean isInitiator() throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1347
}