NewSalt.java revision 3054
10139N/A/*
10139N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
10139N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18213N/A *
10139N/A * This code is free software; you can redistribute it and/or modify it
10139N/A * under the terms of the GNU General Public License version 2 only, as
10139N/A * published by the Free Software Foundation.
17185N/A *
10139N/A * This code is distributed in the hope that it will be useful, but WITHOUT
10139N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18593N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18593N/A * version 2 for more details (a copy is included in the LICENSE file that
18593N/A * accompanied this code).
10139N/A *
15322N/A * You should have received a copy of the GNU General Public License version
18615N/A * 2 along with this work; if not, write to the Free Software Foundation,
10139N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18978N/A *
10139N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
10139N/A * or visit www.oracle.com if you need additional information or have any
10139N/A * questions.
10139N/A */
10139N/A
10139N/A/*
10139N/A * @test
10139N/A * @bug 6960894
10139N/A * @summary Better AS-REQ creation and processing
10139N/A * @run main NewSalt
10139N/A * @run main/othervm -Dnopreauth NewSalt
10139N/A * @run main/othervm -Donlyonepreauth NewSalt
10139N/A */
10139N/A
10139N/Aimport sun.security.jgss.GSSUtil;
10139N/Aimport sun.security.krb5.Config;
10139N/A
10139N/Apublic class NewSalt {
10139N/A
10139N/A public static void main(String[] args)
10139N/A throws Exception {
10139N/A
10139N/A // Create and start the KDC
10139N/A KDC kdc = new OneKDC(null);
10139N/A if (System.getProperty("onlyonepreauth") != null) {
10139N/A KDC.saveConfig(OneKDC.KRB5_CONF, kdc,
10139N/A "default_tgs_enctypes=des3-cbc-sha1");
10139N/A Config.refresh();
10139N/A kdc.setOption(KDC.Option.ONLY_ONE_PREAUTH, true);
10139N/A }
10139N/A if (System.getProperty("nopreauth") != null) {
10139N/A kdc.setOption(KDC.Option.PREAUTH_REQUIRED, false);
10139N/A }
10139N/A
10139N/A // Use a different case of name. KDC will return correct salt
10139N/A Context c1 = Context.fromUserPass(OneKDC.USER.toUpperCase(),
10139N/A OneKDC.PASS, true);
10139N/A Context c2 = Context.fromUserPass(OneKDC.USER2.toUpperCase(),
10139N/A OneKDC.PASS2, true);
10139N/A
10139N/A c1.startAsClient(OneKDC.USER2, GSSUtil.GSS_KRB5_MECH_OID);
10139N/A c2.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
10139N/A
10139N/A Context.handshake(c1, c2);
16796N/A }
10392N/A}
10139N/A