jdk/test/sun/security/krb5/auto/DupEtypes.java
author weijun
Wed, 07 Nov 2012 14:13:01 +0800
changeset 14413 e954df027393
parent 10432 ef33e56c55a9
child 17443 0a7ace07ea11
permissions -rw-r--r--
6355584: Introduce constrained Kerberos delegation Reviewed-by: valeriep
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10432
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
     1
/*
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
     2
 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
     4
 *
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
     7
 * published by the Free Software Foundation.
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
     8
 *
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    13
 * accompanied this code).
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    14
 *
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    18
 *
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    21
 * questions.
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    22
 */
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    23
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    24
/*
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    25
 * @test
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    26
 * @bug 7067974
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    27
 * @summary multiple ETYPE-INFO-ENTRY with same etype and different salt
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    28
 * @compile -XDignore.symbol.file DupEtypes.java
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    29
 * @run main/othervm DupEtypes 1
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    30
 * @run main/othervm DupEtypes 2
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    31
 * @run main/othervm/fail DupEtypes 3
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    32
 * @run main/othervm DupEtypes 4
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    33
 * @run main/othervm DupEtypes 5
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    34
 */
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    35
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    36
import sun.security.jgss.GSSUtil;
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    37
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    38
public class DupEtypes {
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    39
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    40
    public static void main(String[] args) throws Exception {
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    41
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    42
        OneKDC kdc = new OneKDC(null);
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    43
        kdc.writeJAASConf();
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    44
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    45
        // Different test cases, read KDC.processAsReq for details
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    46
        kdc.setOption(KDC.Option.DUP_ETYPE, Integer.parseInt(args[0]));
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    47
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    48
        Context c, s;
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    49
        c = Context.fromJAAS("client");
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    50
        s = Context.fromJAAS("server");
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    51
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    52
        c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    53
        s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    54
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    55
        Context.handshake(c, s);
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    56
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    57
        Context.transmit("i say high --", c, s);
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    58
        Context.transmit("   you say low", s, c);
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    59
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    60
        s.dispose();
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    61
        c.dispose();
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    62
    }
ef33e56c55a9 7067974: multiple ETYPE-INFO-ENTRY with same etype and different salt
weijun
parents:
diff changeset
    63
}