jdk/test/sun/security/krb5/OptionPADataInKDCReq.java
author xdono
Wed, 02 Jul 2008 12:55:45 -0700
changeset 715 f16baef3a20e
parent 75 dedcbd82b6e9
child 5506 202f599c92aa
permissions -rw-r--r--
6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
75
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
     1
/*
715
f16baef3a20e 6719955: Update copyright year
xdono
parents: 75
diff changeset
     2
 * Copyright 2007-2008 Sun Microsystems, Inc.  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
 *
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    21
 * have any questions.
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
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    27
 */
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    28
import sun.security.krb5.internal.ETypeInfo2;
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    29
import sun.security.krb5.internal.KDCReq;
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    30
import sun.security.util.DerValue;
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    31
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    32
public class OptionPADataInKDCReq {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    33
    public static void main(String[] args) throws Exception {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    34
        /*
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    35
         * This is a AS-REQ block without padata. The content is --
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    36
        [APPLICATION 10] SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    37
            [1] INTEGER 5
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    38
            [2] INTEGER 10
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    39
            [4] SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    40
                [0] BIT STRING 01000000 10000001 00000000 00010000
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    41
                [1] SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    42
                    [0] INTEGER 1
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
                        STRING administrator
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    45
                    }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    46
                }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    47
                [2] STRING N3
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    48
                [3] SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    49
                    [0] INTEGER 2
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    50
                    [1] SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    51
                        STRING krbtgt
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    52
                        STRING N3
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    53
                    }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    54
                }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    55
                [5] TIME Sun Sep 13 10:48:05 CST 2037
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    56
                [6] TIME Sun Sep 13 10:48:05 CST 2037
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    57
                [7] INTEGER 2101281516
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    58
                [8] SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    59
                    INTEGER 23
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    60
                    INTEGER -133
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    61
                    INTEGER -128
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    62
                    INTEGER 3
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    63
                    INTEGER 1
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    64
                    INTEGER 24
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    65
                    INTEGER -135
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    66
                }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    67
                [9] SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    68
                    SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    69
                        [0] INTEGER 20
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    70
                        [1] OCTET STRING
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    71
                            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
    72
                    }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    73
                }
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
        byte[] b = {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
    78
            (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
    79
            (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
    80
            (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
    81
            (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
    82
            (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
    83
            (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
    84
            (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
    85
            (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
    86
            (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
    87
            (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
    88
            (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
    89
            (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
    90
            (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
    91
            (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
    92
            (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
    93
            (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
    94
            (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
    95
            (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
    96
            (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
    97
            (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
    98
            (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
    99
            (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
   100
            (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
   101
            (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
   102
            (byte)0x20, (byte)0x20,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   103
        };
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   104
        new KDCReq(b, 0x0a);
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   105
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   106
        /*
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   107
         * This is a fake ETYPEINFO2 block with no salt
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   108
            SEQUENCE {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   109
                [0] INTEGER 0
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   110
                [2] OCTET STRING 0000: 00                                                 .
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   111
            }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   112
         */
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   113
        byte[] b2 = {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   114
            (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
   115
            (byte)0x03, (byte)0x04, (byte)0x01, (byte)0x00,
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   116
        };
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   117
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   118
        ETypeInfo2 e2 = new ETypeInfo2(new DerValue(b2));
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   119
        if (e2.getSalt() != null || e2.getParams() == null) {
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   120
            throw new Exception("ETypeInfo2 decoding error");
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   121
        }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   122
    }
dedcbd82b6e9 6648972: KDCReq.init always read padata
weijun
parents:
diff changeset
   123
}