52N/A/*
2362N/A * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
52N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
52N/A *
52N/A * This code is free software; you can redistribute it and/or modify it
52N/A * under the terms of the GNU General Public License version 2 only, as
52N/A * published by the Free Software Foundation.
52N/A *
52N/A * This code is distributed in the hope that it will be useful, but WITHOUT
52N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
52N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
52N/A * version 2 for more details (a copy is included in the LICENSE file that
52N/A * accompanied this code).
52N/A *
52N/A * You should have received a copy of the GNU General Public License version
52N/A * 2 along with this work; if not, write to the Free Software Foundation,
52N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
52N/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.
52N/A */
52N/A/*
52N/A * @test
52N/A * @bug 6648972
52N/A * @summary KDCReq.init always read padata
52N/A */
52N/Aimport sun.security.krb5.internal.ETypeInfo2;
52N/Aimport sun.security.krb5.internal.KDCReq;
52N/Aimport sun.security.util.DerValue;
52N/A
52N/Apublic class OptionPADataInKDCReq {
52N/A public static void main(String[] args) throws Exception {
52N/A /*
52N/A * This is a AS-REQ block without padata. The content is --
52N/A [APPLICATION 10] SEQUENCE {
52N/A [1] INTEGER 5
52N/A [2] INTEGER 10
52N/A [4] SEQUENCE {
52N/A [0] BIT STRING 01000000 10000001 00000000 00010000
52N/A [1] SEQUENCE {
52N/A [0] INTEGER 1
52N/A [1] SEQUENCE {
52N/A STRING administrator
52N/A }
52N/A }
52N/A [2] STRING N3
52N/A [3] SEQUENCE {
52N/A [0] INTEGER 2
52N/A [1] SEQUENCE {
52N/A STRING krbtgt
52N/A STRING N3
52N/A }
52N/A }
52N/A [5] TIME Sun Sep 13 10:48:05 CST 2037
52N/A [6] TIME Sun Sep 13 10:48:05 CST 2037
52N/A [7] INTEGER 2101281516
52N/A [8] SEQUENCE {
52N/A INTEGER 23
52N/A INTEGER -133
52N/A INTEGER -128
52N/A INTEGER 3
52N/A INTEGER 1
52N/A INTEGER 24
52N/A INTEGER -135
52N/A }
52N/A [9] SEQUENCE {
52N/A SEQUENCE {
52N/A [0] INTEGER 20
52N/A [1] OCTET STRING
52N/A 0000: 58 50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 XP
52N/A }
52N/A }
52N/A }
52N/A }
52N/A */
52N/A byte[] b = {
52N/A (byte)0x6a, (byte)0x81, (byte)0xbf, (byte)0x30, (byte)0x81, (byte)0xbc, (byte)0xa1, (byte)0x03,
52N/A (byte)0x02, (byte)0x01, (byte)0x05, (byte)0xa2, (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x0a,
52N/A (byte)0xa4, (byte)0x81, (byte)0xaf, (byte)0x30, (byte)0x81, (byte)0xac, (byte)0xa0, (byte)0x07,
52N/A (byte)0x03, (byte)0x05, (byte)0x00, (byte)0x40, (byte)0x81, (byte)0x00, (byte)0x10, (byte)0xa1,
52N/A (byte)0x1a, (byte)0x30, (byte)0x18, (byte)0xa0, (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x01,
52N/A (byte)0xa1, (byte)0x11, (byte)0x30, (byte)0x0f, (byte)0x1b, (byte)0x0d, (byte)0x61, (byte)0x64,
52N/A (byte)0x6d, (byte)0x69, (byte)0x6e, (byte)0x69, (byte)0x73, (byte)0x74, (byte)0x72, (byte)0x61,
52N/A (byte)0x74, (byte)0x6f, (byte)0x72, (byte)0xa2, (byte)0x04, (byte)0x1b, (byte)0x02, (byte)0x4e,
52N/A (byte)0x33, (byte)0xa3, (byte)0x17, (byte)0x30, (byte)0x15, (byte)0xa0, (byte)0x03, (byte)0x02,
52N/A (byte)0x01, (byte)0x02, (byte)0xa1, (byte)0x0e, (byte)0x30, (byte)0x0c, (byte)0x1b, (byte)0x06,
52N/A (byte)0x6b, (byte)0x72, (byte)0x62, (byte)0x74, (byte)0x67, (byte)0x74, (byte)0x1b, (byte)0x02,
52N/A (byte)0x4e, (byte)0x33, (byte)0xa5, (byte)0x11, (byte)0x18, (byte)0x0f, (byte)0x32, (byte)0x30,
52N/A (byte)0x33, (byte)0x37, (byte)0x30, (byte)0x39, (byte)0x31, (byte)0x33, (byte)0x30, (byte)0x32,
52N/A (byte)0x34, (byte)0x38, (byte)0x30, (byte)0x35, (byte)0x5a, (byte)0xa6, (byte)0x11, (byte)0x18,
52N/A (byte)0x0f, (byte)0x32, (byte)0x30, (byte)0x33, (byte)0x37, (byte)0x30, (byte)0x39, (byte)0x31,
52N/A (byte)0x33, (byte)0x30, (byte)0x32, (byte)0x34, (byte)0x38, (byte)0x30, (byte)0x35, (byte)0x5a,
52N/A (byte)0xa7, (byte)0x06, (byte)0x02, (byte)0x04, (byte)0x7d, (byte)0x3f, (byte)0x02, (byte)0xec,
52N/A (byte)0xa8, (byte)0x19, (byte)0x30, (byte)0x17, (byte)0x02, (byte)0x01, (byte)0x17, (byte)0x02,
52N/A (byte)0x02, (byte)0xff, (byte)0x7b, (byte)0x02, (byte)0x01, (byte)0x80, (byte)0x02, (byte)0x01,
52N/A (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x01, (byte)0x02, (byte)0x01, (byte)0x18, (byte)0x02,
52N/A (byte)0x02, (byte)0xff, (byte)0x79, (byte)0xa9, (byte)0x1d, (byte)0x30, (byte)0x1b, (byte)0x30,
52N/A (byte)0x19, (byte)0xa0, (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x14, (byte)0xa1, (byte)0x12,
52N/A (byte)0x04, (byte)0x10, (byte)0x58, (byte)0x50, (byte)0x20, (byte)0x20, (byte)0x20, (byte)0x20,
52N/A (byte)0x20, (byte)0x20, (byte)0x20, (byte)0x20, (byte)0x20, (byte)0x20, (byte)0x20, (byte)0x20,
52N/A (byte)0x20, (byte)0x20,
52N/A };
52N/A new KDCReq(b, 0x0a);
52N/A
52N/A /*
52N/A * This is a fake ETYPEINFO2 block with no salt
52N/A SEQUENCE {
52N/A [0] INTEGER 0
52N/A [2] OCTET STRING 0000: 00 .
52N/A }
52N/A */
52N/A byte[] b2 = {
52N/A (byte)0x30, (byte)0x0a, (byte)0xa0, (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x00, (byte)0xa2,
52N/A (byte)0x03, (byte)0x04, (byte)0x01, (byte)0x00,
52N/A };
52N/A
52N/A ETypeInfo2 e2 = new ETypeInfo2(new DerValue(b2));
52N/A if (e2.getSalt() != null || e2.getParams() == null) {
52N/A throw new Exception("ETypeInfo2 decoding error");
52N/A }
52N/A }
52N/A}