jdk/test/sun/security/krb5/OptionPADataInKDCReq.java
author stefank
Mon, 04 Apr 2016 09:15:01 +0200
changeset 37241 b9961c99c356
parent 30820 0d4717a011d3
permissions -rw-r--r--
8152538: UL doesn't inline the LogTagSet::is_level check Reviewed-by: mlarsson, brutisso
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
75
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
     2
 * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
75
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
     4
 *
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
     7
 * published by the Free Software Foundation.
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
     8
 *
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    13
 * accompanied this code).
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    14
 *
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
    21
 * questions.
75
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    22
 */
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    23
/*
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    24
 * @test
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    25
 * @bug 6648972
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    26
 * @summary KDCReq.init always read padata
30820
0d4717a011d3 8081347: Add @modules to jdk_core tests
mchung
parents: 5506
diff changeset
    27
 * @modules java.base/sun.security.util
0d4717a011d3 8081347: Add @modules to jdk_core tests
mchung
parents: 5506
diff changeset
    28
 *          java.security.jgss/sun.security.krb5.internal
75
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    29
 */
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    30
import sun.security.krb5.internal.ETypeInfo2;
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    31
import sun.security.krb5.internal.KDCReq;
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    32
import sun.security.util.DerValue;
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    33
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    34
public class OptionPADataInKDCReq {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    35
    public static void main(String[] args) throws Exception {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    36
        /*
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    37
         * This is a AS-REQ block without padata. The content is --
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    38
        [APPLICATION 10] SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    39
            [1] INTEGER 5
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    40
            [2] INTEGER 10
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    41
            [4] SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    42
                [0] BIT STRING 01000000 10000001 00000000 00010000
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    43
                [1] SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    44
                    [0] INTEGER 1
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    45
                    [1] SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    46
                        STRING administrator
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    47
                    }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    48
                }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    49
                [2] STRING N3
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    50
                [3] SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    51
                    [0] INTEGER 2
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    52
                    [1] SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    53
                        STRING krbtgt
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    54
                        STRING N3
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    55
                    }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    56
                }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    57
                [5] TIME Sun Sep 13 10:48:05 CST 2037
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    58
                [6] TIME Sun Sep 13 10:48:05 CST 2037
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    59
                [7] INTEGER 2101281516
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    60
                [8] SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    61
                    INTEGER 23
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    62
                    INTEGER -133
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    63
                    INTEGER -128
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    64
                    INTEGER 3
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    65
                    INTEGER 1
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    66
                    INTEGER 24
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    67
                    INTEGER -135
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    68
                }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    69
                [9] SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    70
                    SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    71
                        [0] INTEGER 20
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    72
                        [1] OCTET STRING
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    73
                            0000: 58 50 20 20 20 20 20 20   20 20 20 20 20 20 20 20  XP
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    74
                    }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    75
                }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    76
            }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    77
        }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    78
        */
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    79
        byte[] b = {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    80
            (byte)0x6a, (byte)0x81, (byte)0xbf, (byte)0x30, (byte)0x81, (byte)0xbc, (byte)0xa1, (byte)0x03,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    81
            (byte)0x02, (byte)0x01, (byte)0x05, (byte)0xa2, (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x0a,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    82
            (byte)0xa4, (byte)0x81, (byte)0xaf, (byte)0x30, (byte)0x81, (byte)0xac, (byte)0xa0, (byte)0x07,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    83
            (byte)0x03, (byte)0x05, (byte)0x00, (byte)0x40, (byte)0x81, (byte)0x00, (byte)0x10, (byte)0xa1,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    84
            (byte)0x1a, (byte)0x30, (byte)0x18, (byte)0xa0, (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x01,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    85
            (byte)0xa1, (byte)0x11, (byte)0x30, (byte)0x0f, (byte)0x1b, (byte)0x0d, (byte)0x61, (byte)0x64,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    86
            (byte)0x6d, (byte)0x69, (byte)0x6e, (byte)0x69, (byte)0x73, (byte)0x74, (byte)0x72, (byte)0x61,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    87
            (byte)0x74, (byte)0x6f, (byte)0x72, (byte)0xa2, (byte)0x04, (byte)0x1b, (byte)0x02, (byte)0x4e,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    88
            (byte)0x33, (byte)0xa3, (byte)0x17, (byte)0x30, (byte)0x15, (byte)0xa0, (byte)0x03, (byte)0x02,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    89
            (byte)0x01, (byte)0x02, (byte)0xa1, (byte)0x0e, (byte)0x30, (byte)0x0c, (byte)0x1b, (byte)0x06,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    90
            (byte)0x6b, (byte)0x72, (byte)0x62, (byte)0x74, (byte)0x67, (byte)0x74, (byte)0x1b, (byte)0x02,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    91
            (byte)0x4e, (byte)0x33, (byte)0xa5, (byte)0x11, (byte)0x18, (byte)0x0f, (byte)0x32, (byte)0x30,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    92
            (byte)0x33, (byte)0x37, (byte)0x30, (byte)0x39, (byte)0x31, (byte)0x33, (byte)0x30, (byte)0x32,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    93
            (byte)0x34, (byte)0x38, (byte)0x30, (byte)0x35, (byte)0x5a, (byte)0xa6, (byte)0x11, (byte)0x18,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    94
            (byte)0x0f, (byte)0x32, (byte)0x30, (byte)0x33, (byte)0x37, (byte)0x30, (byte)0x39, (byte)0x31,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    95
            (byte)0x33, (byte)0x30, (byte)0x32, (byte)0x34, (byte)0x38, (byte)0x30, (byte)0x35, (byte)0x5a,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    96
            (byte)0xa7, (byte)0x06, (byte)0x02, (byte)0x04, (byte)0x7d, (byte)0x3f, (byte)0x02, (byte)0xec,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    97
            (byte)0xa8, (byte)0x19, (byte)0x30, (byte)0x17, (byte)0x02, (byte)0x01, (byte)0x17, (byte)0x02,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    98
            (byte)0x02, (byte)0xff, (byte)0x7b, (byte)0x02, (byte)0x01, (byte)0x80, (byte)0x02, (byte)0x01,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    99
            (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x01, (byte)0x02, (byte)0x01, (byte)0x18, (byte)0x02,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   100
            (byte)0x02, (byte)0xff, (byte)0x79, (byte)0xa9, (byte)0x1d, (byte)0x30, (byte)0x1b, (byte)0x30,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   101
            (byte)0x19, (byte)0xa0, (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x14, (byte)0xa1, (byte)0x12,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   102
            (byte)0x04, (byte)0x10, (byte)0x58, (byte)0x50, (byte)0x20, (byte)0x20, (byte)0x20, (byte)0x20,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   103
            (byte)0x20, (byte)0x20, (byte)0x20, (byte)0x20, (byte)0x20, (byte)0x20, (byte)0x20, (byte)0x20,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   104
            (byte)0x20, (byte)0x20,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   105
        };
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   106
        new KDCReq(b, 0x0a);
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   107
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   108
        /*
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   109
         * This is a fake ETYPEINFO2 block with no salt
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   110
            SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   111
                [0] INTEGER 0
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   112
                [2] OCTET STRING 0000: 00                                                 .
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   113
            }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   114
         */
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   115
        byte[] b2 = {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   116
            (byte)0x30, (byte)0x0a, (byte)0xa0, (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x00, (byte)0xa2,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   117
            (byte)0x03, (byte)0x04, (byte)0x01, (byte)0x00,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   118
        };
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   119
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   120
        ETypeInfo2 e2 = new ETypeInfo2(new DerValue(b2));
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   121
        if (e2.getSalt() != null || e2.getParams() == null) {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   122
            throw new Exception("ETypeInfo2 decoding error");
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   123
        }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   124
    }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   125
}