jdk/src/share/classes/sun/security/jgss/spi/GSSContextSpi.java
author malenkov
Tue, 29 Oct 2013 17:01:06 +0400
changeset 21278 ef8a3a2a72f2
parent 14342 8435a30053c1
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
/*
14342
8435a30053c1 7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents: 9682
diff changeset
     2
 * Copyright (c) 2000, 2011, 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
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 *  (C) Copyright IBM Corp. 1999 All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *  Copyright 1997 The Open Group Research Institute.  All rights reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
package sun.security.jgss.spi;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import org.ietf.jgss.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.io.InputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.io.OutputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.security.Provider;
3482
4aaa66ce712d 6710360: export Kerberos session key to applications
weijun
parents: 2
diff changeset
    37
import com.sun.security.jgss.*;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * This interface is implemented by a mechanism specific instance of a GSS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * security context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * A GSSContextSpi object can be thought of having 3 states:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *    -before initialization
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *    -during initialization with its peer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *    -after it is established
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * The context options can only be requested in state 1. In state 3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * the per message operations are available to the callers. The get
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * methods for the context options will return the requested options
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * while in state 1 and 2, and the established values in state 3.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * Some mechanisms may allow the access to the per-message operations
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * and the context flags before the context is fully established. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * isProtReady method is used to indicate that these services are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * available.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * <strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * Context establishment tokens are defined in a mechanism independent
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * format in section 3.1 of RFC 2743. The GSS-Framework will add
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * and remove the mechanism independent header portion of this token format
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * depending on whether a token is received or is being sent. The mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * should only generate or expect to read the inner-context token portion..
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * On the other hands, tokens used for per-message calls are generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * entirely by the mechanism. It is possible that the mechanism chooses to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * encase inner-level per-message tokens in a header similar to that used
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * for initial tokens, however, this is upto the mechanism to do. The token
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * to/from the per-message calls are opaque to the GSS-Framework.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * </strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * An attempt has been made to allow for reading the peer's tokens from an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * InputStream and writing tokens for the peer to an OutputStream. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * allows applications to pass in streams that are obtained from their network
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * connections and thus minimize the buffer copies that will happen. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * is especially important for tokens generated by wrap() which are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * proportional in size to the length of the application data being
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * wrapped, and are probably also the most frequently used type of tokens.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * It is anticipated that most applications will want to use wrap() in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * fashion where they obtain the application bytes to wrap from a byte[]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * but want to output the wrap token straight to an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * OutputStream. Similarly, they will want to use unwrap() where they read
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * the token directly form an InputStream but output it to some byte[] for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * the application to process. Unfortunately the high level GSS bindings
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * do not contain overloaded forms of wrap() and unwrap() that do just
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * this, however we have accomodated those cases here with the expectation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * that this will be rolled into the high level bindings sooner or later.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * @author Mayank Upadhyay
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
public interface GSSContextSpi {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    public Provider getProvider();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    // The specification for the following methods mirrors the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    // specification of the same methods in the GSSContext interface, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    // defined in RFC 2853.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    public void requestLifetime(int lifetime) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    public void requestMutualAuth(boolean state) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    public void requestReplayDet(boolean state) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    public void requestSequenceDet(boolean state) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    public void requestCredDeleg(boolean state) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    public void requestAnonymity(boolean state) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    public void requestConf(boolean state) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    public void requestInteg(boolean state) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
4336
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents: 3482
diff changeset
   115
    public void requestDelegPolicy(boolean state) throws GSSException;
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents: 3482
diff changeset
   116
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    public void setChannelBinding(ChannelBinding cb) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    public boolean getCredDelegState();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    public boolean getMutualAuthState();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    public boolean getReplayDetState();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    public boolean getSequenceDetState();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    public boolean getAnonymityState();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
4336
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents: 3482
diff changeset
   129
    public boolean getDelegPolicyState();
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents: 3482
diff changeset
   130
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    public boolean isTransferable() throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    public boolean isProtReady();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    public boolean isInitiator();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    public boolean getConfState();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    public boolean getIntegState();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    public int getLifetime();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    public boolean isEstablished();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    public GSSNameSpi getSrcName() throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    public GSSNameSpi getTargName() throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    public Oid getMech() throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    public GSSCredentialSpi getDelegCred() throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * Initiator context establishment call. This method may be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * required to be called several times. A CONTINUE_NEEDED return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * call indicates that more calls are needed after the next token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * is received from the peer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * This method is called by the GSS-Framework when the application
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * calls the initSecContext method on the GSSContext implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * that it has a reference to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * All overloaded forms of GSSContext.initSecContext() can be handled
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * with this mechanism level initSecContext. Since the output token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * from this method is a fixed size, not exeedingly large, and a one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * time deal, an overloaded form that takes an OutputStream has not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * been defined. The GSS-Framwork can write the returned byte[] to any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * application provided OutputStream. Similarly, any application input
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * int he form of byte arrays will be wrapped in an input stream by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * GSS-Framework and then passed here.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * <strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * The GSS-Framework will strip off the leading mechanism independent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * GSS-API header. In other words, only the mechanism specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * inner-context token of RFC 2743 section 3.1 will be available on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * InputStream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * </strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * @param is contains the inner context token portion of the GSS token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * received from the peer. On the first call to initSecContext, there
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * will be no token hence it will be ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * @param mechTokenSize the size of the inner context token as read by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * the GSS-Framework from the mechanism independent GSS-API level
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * header.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * @return any inner-context token required to be sent to the peer as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * part of a GSS token. The mechanism should not add the mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * independent part of the token. The GSS-Framework will add that on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * the way out.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * @exception GSSException may be thrown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    public byte[] initSecContext(InputStream is, int mechTokenSize)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                        throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * Acceptor's context establishment call. This method may be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * required to be called several times. A CONTINUE_NEEDED return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * call indicates that more calls are needed after the next token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * is received from the peer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * This method is called by the GSS-Framework when the application
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * calls the acceptSecContext method on the GSSContext implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * that it has a reference to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * All overloaded forms of GSSContext.acceptSecContext() can be handled
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * with this mechanism level acceptSecContext. Since the output token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * from this method is a fixed size, not exeedingly large, and a one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * time deal, an overloaded form that takes an OutputStream has not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * been defined. The GSS-Framwork can write the returned byte[] to any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * application provided OutputStream. Similarly, any application input
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * int he form of byte arrays will be wrapped in an input stream by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * GSS-Framework and then passed here.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * <strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * The GSS-Framework will strip off the leading mechanism independent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * GSS-API header. In other words, only the mechanism specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * inner-context token of RFC 2743 section 3.1 will be available on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * InputStream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * </strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * @param is contains the inner context token portion of the GSS token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * received from the peer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * @param mechTokenSize the size of the inner context token as read by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * the GSS-Framework from the mechanism independent GSS-API level
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * header.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * @return any inner-context token required to be sent to the peer as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * part of a GSS token. The mechanism should not add the mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * independent part of the token. The GSS-Framework will add that on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * the way out.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * @exception GSSException may be thrown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    public byte[] acceptSecContext(InputStream is, int mechTokenSize)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
                        throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    /**
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 14342
diff changeset
   235
     * Queries the context for largest data size to accommodate
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * the specified protection and for the token to remain less then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * maxTokSize.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * @param qop the quality of protection that the context will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     *    asked to provide.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * @param confReq a flag indicating whether confidentiality will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     *    requested or not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @param outputSize the maximum size of the output token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * @return the maximum size for the input message that can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     *    provided to the wrap() method in order to guarantee that these
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     *    requirements are met.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * @exception GSSException may be thrown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    public int getWrapSizeLimit(int qop, boolean confReq, int maxTokSize)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                        throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * Provides per-message token encapsulation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * @param is the user-provided message to be protected
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * @param os the token to be sent to the peer. It includes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     *    the message from <i>is</i> with the requested protection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * @param msgPro on input it contains the requested qop and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     *    confidentiality state, on output, the applied values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * @exception GSSException may be thrown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * @see unwrap
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    public void wrap(InputStream is, OutputStream os, MessageProp msgProp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
        throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * For apps that want simplicity and don't care about buffer copies.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    public byte[] wrap(byte inBuf[], int offset, int len,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
                       MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * For apps that care about buffer copies but either cannot use streams
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * or want to avoid them for whatever reason. (Say, they are using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * block ciphers.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * NOTE: This method is not defined in public class org.ietf.jgss.GSSContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    public int wrap(byte inBuf[], int inOffset, int len,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
                    byte[] outBuf, int outOffset,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
                    MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * For apps that want to read from a specific application provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * buffer but want to write directly to the network stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * Can be achieved by converting the input buffer to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * ByteInputStream. Provided to keep the API consistent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * with unwrap.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * NOTE: This method is not defined in public class org.ietf.jgss.GSSContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    public void wrap(byte inBuf[], int offset, int len,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
                     OutputStream os, MessageProp msgProp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * Retrieves the message token previously encapsulated in the wrap
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * call.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * @param is the token from the peer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * @param os unprotected message data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * @param msgProp will contain the applied qop and confidentiality
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     *    of the input token and any informatory status values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * @exception GSSException may be thrown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * @see wrap
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    public void unwrap(InputStream is, OutputStream os,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
                        MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    /**
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 14342
diff changeset
   316
     * For apps that want simplicity and don't care about buffer copies.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    public byte[] unwrap(byte inBuf[], int offset, int len,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
                         MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * For apps that care about buffer copies but either cannot use streams
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * or want to avoid them for whatever reason. (Say, they are using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * block ciphers.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * NOTE: This method is not defined in public class org.ietf.jgss.GSSContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    public int unwrap(byte inBuf[], int inOffset, int len,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
                      byte[] outBuf, int outOffset,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
                      MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * For apps that care about buffer copies and want to read
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * straight from the network, but also want the output in a specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * application provided buffer, say to reduce buffer allocation or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * subsequent copy.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * NOTE: This method is not defined in public class org.ietf.jgss.GSSContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    public int unwrap(InputStream is,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
                       byte[] outBuf, int outOffset,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
                       MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * Applies per-message integrity services.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * @param is the user-provided message
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * @param os the token to be sent to the peer along with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     *    message token. The message token <b>is not</b> encapsulated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * @param msgProp on input the desired QOP and output the applied QOP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * @exception GSSException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    public void getMIC(InputStream is, OutputStream os,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
                        MessageProp msgProp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
                throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    public byte[] getMIC(byte []inMsg, int offset, int len,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
                         MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * Checks the integrity of the supplied tokens.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * This token was previously generated by getMIC.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * @param is token generated by getMIC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * @param msgStr the message to check integrity for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * @param msgProp will contain the applied QOP and confidentiality
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     *    states of the token as well as any informatory status codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * @exception GSSException may be thrown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    public void verifyMIC(InputStream is, InputStream msgStr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
                           MessageProp mProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    public void verifyMIC(byte []inTok, int tokOffset, int tokLen,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                          byte[] inMsg, int msgOffset, int msgLen,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
                          MessageProp msgProp) throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * Produces a token representing this context. After this call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     * the context will no longer be usable until an import is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * performed on the returned token.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * @return exported context token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * @exception GSSException may be thrown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    public byte[] export() throws GSSException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * Releases context resources and terminates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * context between 2 peer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * @exception GSSException may be thrown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
    public void dispose() throws GSSException;
3482
4aaa66ce712d 6710360: export Kerberos session key to applications
weijun
parents: 2
diff changeset
   397
4aaa66ce712d 6710360: export Kerberos session key to applications
weijun
parents: 2
diff changeset
   398
    /**
4aaa66ce712d 6710360: export Kerberos session key to applications
weijun
parents: 2
diff changeset
   399
     * Return the mechanism-specific attribute associated with (@code type}.
4aaa66ce712d 6710360: export Kerberos session key to applications
weijun
parents: 2
diff changeset
   400
     *
4aaa66ce712d 6710360: export Kerberos session key to applications
weijun
parents: 2
diff changeset
   401
     * @param type the type of the attribute requested
4aaa66ce712d 6710360: export Kerberos session key to applications
weijun
parents: 2
diff changeset
   402
     * @return the attribute
4aaa66ce712d 6710360: export Kerberos session key to applications
weijun
parents: 2
diff changeset
   403
     * @throws GSSException see {@link ExtendedGSSContext#inquireSecContext}
4aaa66ce712d 6710360: export Kerberos session key to applications
weijun
parents: 2
diff changeset
   404
     * for details
4aaa66ce712d 6710360: export Kerberos session key to applications
weijun
parents: 2
diff changeset
   405
     */
4aaa66ce712d 6710360: export Kerberos session key to applications
weijun
parents: 2
diff changeset
   406
    public Object inquireSecContext(InquireType type)
4aaa66ce712d 6710360: export Kerberos session key to applications
weijun
parents: 2
diff changeset
   407
            throws GSSException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
}