0N/A/*
2362N/A * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A/*
0N/A * @test
0N/A * @bug 6570062
0N/A * @summary Kerberos authentication regression
0N/A */
0N/A
0N/Aimport sun.security.krb5.internal.KRBError;
0N/Aimport sun.security.krb5.internal.Krb5;
0N/Aimport sun.security.util.DerValue;
0N/A
0N/Apublic class PAData {
0N/A public static void main(String[] args) throws Exception {
0N/A // This is the dump of a KRB-ERROR data, no sensitive info included.
0N/A byte[] bytes = {
0N/A (byte)0X7E, (byte)0X71, (byte)0X30, (byte)0X6F,
0N/A (byte)0XA0, (byte)0X03, (byte)0X02, (byte)0X01,
0N/A (byte)0X05, (byte)0XA1, (byte)0X03, (byte)0X02,
0N/A (byte)0X01, (byte)0X1E, (byte)0XA4, (byte)0X11,
0N/A (byte)0X18, (byte)0X0F, (byte)0X32, (byte)0X30,
0N/A (byte)0X30, (byte)0X37, (byte)0X30, (byte)0X36,
0N/A (byte)0X32, (byte)0X31, (byte)0X32, (byte)0X31,
0N/A (byte)0X30, (byte)0X32, (byte)0X34, (byte)0X33,
0N/A (byte)0X5A, (byte)0XA5, (byte)0X05, (byte)0X02,
0N/A (byte)0X03, (byte)0X0A, (byte)0XC8, (byte)0XC5,
0N/A (byte)0XA6, (byte)0X03, (byte)0X02, (byte)0X01,
0N/A (byte)0X12, /* The errorcode at bytes[44] */
0N/A (byte)0XA9, (byte)0X0A, (byte)0X1B,
0N/A (byte)0X08, (byte)0X4E, (byte)0X33, (byte)0X2E,
0N/A (byte)0X4C, (byte)0X4F, (byte)0X43, (byte)0X41,
0N/A (byte)0X4C, (byte)0XAA, (byte)0X1D, (byte)0X30,
0N/A (byte)0X1B, (byte)0XA0, (byte)0X03, (byte)0X02,
0N/A (byte)0X01, (byte)0X02, (byte)0XA1, (byte)0X14,
0N/A (byte)0X30, (byte)0X12, (byte)0X1B, (byte)0X06,
0N/A (byte)0X6B, (byte)0X72, (byte)0X62, (byte)0X74,
0N/A (byte)0X67, (byte)0X74, (byte)0X1B, (byte)0X08,
0N/A (byte)0X4E, (byte)0X33, (byte)0X2E, (byte)0X4C,
0N/A (byte)0X4F, (byte)0X43, (byte)0X41, (byte)0X4C,
0N/A (byte)0XAC, (byte)0X19, (byte)0X04, (byte)0X17,
0N/A (byte)0X30, (byte)0X15, (byte)0XA1, (byte)0X03,
0N/A (byte)0X02, (byte)0X01, (byte)0X03, (byte)0XA2,
0N/A (byte)0X0E, (byte)0X04, (byte)0X0C, (byte)0X72,
0N/A (byte)0X00, (byte)0X00, (byte)0XC0, (byte)0X00,
0N/A (byte)0X00, (byte)0X00, (byte)0X00, (byte)0X01,
0N/A (byte)0X00, (byte)0X00, (byte)0X00
0N/A };
0N/A String err = "";
0N/A
0N/A try {
0N/A new KRBError(new DerValue(bytes));
0N/A } catch (Exception e) {
0N/A err += "Test 1 fails.\n";
0N/A }
0N/A
0N/A try {
0N/A bytes[44] = Krb5.KDC_ERR_PREAUTH_REQUIRED;
0N/A new KRBError(new DerValue(bytes));
0N/A err += "Test 2 fails.\n";
0N/A } catch (Exception e) {
0N/A // correct bahavior
0N/A }
0N/A if (err != "") {
0N/A throw new Exception(err);
0N/A }
0N/A }
0N/A}