jdk/test/sun/security/krb5/ktab/HighestKvno.java
author weijun
Mon, 28 Nov 2011 18:16:29 +0800
changeset 11107 fc8efc57da08
parent 9008 1c23e333dd76
child 30820 0d4717a011d3
permissions -rw-r--r--
7115744: Do not call File::deleteOnExit in security tests Reviewed-by: xuelei
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3626
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
     1
/*
9008
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 5974
diff changeset
     2
 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
3626
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
     4
 *
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
     7
 * published by the Free Software Foundation.
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
     8
 *
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    13
 * accompanied this code).
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    14
 *
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3634
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3634
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3634
diff changeset
    21
 * questions.
3626
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    22
 */
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    23
/*
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    24
 * @test
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    25
 * @bug 6867665
3634
1c8db1b32565 6875033: regression: test of 6867665 fail
weijun
parents: 3626
diff changeset
    26
 * @bug 6875033
9008
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 5974
diff changeset
    27
 * @run main/othervm HighestKvno
3626
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    28
 * @summary Problem with keytabs with multiple kvno's (key versions)
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    29
 */
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    30
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    31
import sun.security.krb5.internal.ktab.*;
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    32
import sun.security.krb5.*;
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    33
import java.io.File;
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    34
import java.io.FileOutputStream;
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    35
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    36
public class HighestKvno {
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    37
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    38
    public static void main(String[] args) throws Exception {
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    39
        // kt is a keytab including these entries:
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    40
        //
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    41
        // me@MAD.LOCAL: Type: 3, KVNO: 4
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    42
        // me@MAD.LOCAL: Type: 23, KVNO: 4
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    43
        // me@MAD.LOCAL: Type: 16, KVNO: 4
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    44
        // me@MAD.LOCAL: Type: 1, KVNO: 5
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    45
        // me@MAD.LOCAL: Type: 17, KVNO: 5
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    46
        // me@MAD.LOCAL: Type: 18, KVNO: 5
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    47
        // me@MAD.LOCAL: Type: 1, KVNO: 3
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    48
        // me@MAD.LOCAL: Type: 17, KVNO: 3
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    49
        // me@MAD.LOCAL: Type: 18, KVNO: 3
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    50
        // he@MAD.LOCAL: Type: 1, KVNO: 1
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    51
        // he@MAD.LOCAL: Type: 17, KVNO: 1
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    52
        // he@MAD.LOCAL: Type: 18, KVNO: 1
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    53
        //
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    54
        // This file is created with these steps:
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    55
        // 1. Modify JRE's Ktab.java so that adding new entries
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    56
        //    does not remove the old one.
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    57
        // 2. Run the modified Ktab to create 4 sets of keys
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    58
        // 3. Manually hex edit the KVNO as above
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    59
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    60
        byte[] kt = {
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    61
            (byte)0x05, (byte)0x02, (byte)0x00, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    62
            (byte)0x00, (byte)0x26, (byte)0x00, (byte)0x01,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    63
            (byte)0x00, (byte)0x09, (byte)0x4D, (byte)0x41,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    64
            (byte)0x44, (byte)0x2E, (byte)0x4C, (byte)0x4F,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    65
            (byte)0x43, (byte)0x41, (byte)0x4C, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    66
            (byte)0x02, (byte)0x6D, (byte)0x65, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    67
            (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x4A,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    68
            (byte)0x79, (byte)0x45, (byte)0xCD, (byte)0x04,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    69
            (byte)0x00, (byte)0x03, (byte)0x00, (byte)0x08,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    70
            (byte)0xE6, (byte)0xB0, (byte)0x07, (byte)0xA8,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    71
            (byte)0x5B, (byte)0xF8, (byte)0x73, (byte)0xAD,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    72
            (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x2E,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    73
            (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x09,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    74
            (byte)0x4D, (byte)0x41, (byte)0x44, (byte)0x2E,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    75
            (byte)0x4C, (byte)0x4F, (byte)0x43, (byte)0x41,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    76
            (byte)0x4C, (byte)0x00, (byte)0x02, (byte)0x6D,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    77
            (byte)0x65, (byte)0x00, (byte)0x00, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    78
            (byte)0x00, (byte)0x4A, (byte)0x79, (byte)0x45,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    79
            (byte)0xCD, (byte)0x04, (byte)0x00, (byte)0x17,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    80
            (byte)0x00, (byte)0x10, (byte)0x50, (byte)0x92,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    81
            (byte)0x01, (byte)0x6B, (byte)0xCF, (byte)0x5A,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    82
            (byte)0x2A, (byte)0x7A, (byte)0x4F, (byte)0xE8,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    83
            (byte)0x39, (byte)0xD9, (byte)0x90, (byte)0xB5,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    84
            (byte)0x9C, (byte)0xEB, (byte)0x00, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    85
            (byte)0x00, (byte)0x36, (byte)0x00, (byte)0x01,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    86
            (byte)0x00, (byte)0x09, (byte)0x4D, (byte)0x41,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    87
            (byte)0x44, (byte)0x2E, (byte)0x4C, (byte)0x4F,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    88
            (byte)0x43, (byte)0x41, (byte)0x4C, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    89
            (byte)0x02, (byte)0x6D, (byte)0x65, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    90
            (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x4A,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    91
            (byte)0x79, (byte)0x45, (byte)0xCD, (byte)0x04,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    92
            (byte)0x00, (byte)0x10, (byte)0x00, (byte)0x18,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    93
            (byte)0xDF, (byte)0xDF, (byte)0x62, (byte)0x86,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    94
            (byte)0x37, (byte)0xCE, (byte)0x29, (byte)0xBA,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    95
            (byte)0xBC, (byte)0x23, (byte)0x15, (byte)0xDC,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    96
            (byte)0x86, (byte)0x7C, (byte)0xB6, (byte)0x89,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    97
            (byte)0x25, (byte)0x25, (byte)0xCD, (byte)0x4A,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    98
            (byte)0x9B, (byte)0xCE, (byte)0xF4, (byte)0xAE,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
    99
            (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x26,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   100
            (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x09,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   101
            (byte)0x4D, (byte)0x41, (byte)0x44, (byte)0x2E,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   102
            (byte)0x4C, (byte)0x4F, (byte)0x43, (byte)0x41,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   103
            (byte)0x4C, (byte)0x00, (byte)0x02, (byte)0x6D,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   104
            (byte)0x65, (byte)0x00, (byte)0x00, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   105
            (byte)0x00, (byte)0x4A, (byte)0x79, (byte)0x4B,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   106
            (byte)0x5E, (byte)0x05, (byte)0x00, (byte)0x01,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   107
            (byte)0x00, (byte)0x08, (byte)0xE6, (byte)0xB0,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   108
            (byte)0x07, (byte)0xA8, (byte)0x5B, (byte)0xF8,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   109
            (byte)0x73, (byte)0xAD, (byte)0x00, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   110
            (byte)0x00, (byte)0x2E, (byte)0x00, (byte)0x01,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   111
            (byte)0x00, (byte)0x09, (byte)0x4D, (byte)0x41,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   112
            (byte)0x44, (byte)0x2E, (byte)0x4C, (byte)0x4F,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   113
            (byte)0x43, (byte)0x41, (byte)0x4C, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   114
            (byte)0x02, (byte)0x6D, (byte)0x65, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   115
            (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x4A,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   116
            (byte)0x79, (byte)0x4B, (byte)0x5E, (byte)0x05,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   117
            (byte)0x00, (byte)0x11, (byte)0x00, (byte)0x10,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   118
            (byte)0xEA, (byte)0xF5, (byte)0xA8, (byte)0x36,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   119
            (byte)0xA5, (byte)0x3E, (byte)0x5F, (byte)0x5C,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   120
            (byte)0x26, (byte)0xE9, (byte)0xDD, (byte)0x8B,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   121
            (byte)0x8C, (byte)0xE8, (byte)0x92, (byte)0x9C,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   122
            (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x3E,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   123
            (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x09,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   124
            (byte)0x4D, (byte)0x41, (byte)0x44, (byte)0x2E,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   125
            (byte)0x4C, (byte)0x4F, (byte)0x43, (byte)0x41,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   126
            (byte)0x4C, (byte)0x00, (byte)0x02, (byte)0x6D,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   127
            (byte)0x65, (byte)0x00, (byte)0x00, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   128
            (byte)0x00, (byte)0x4A, (byte)0x79, (byte)0x4B,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   129
            (byte)0x5E, (byte)0x05, (byte)0x00, (byte)0x12,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   130
            (byte)0x00, (byte)0x20, (byte)0x68, (byte)0xBE,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   131
            (byte)0xD4, (byte)0x17, (byte)0x3A, (byte)0x06,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   132
            (byte)0xE0, (byte)0x0C, (byte)0x62, (byte)0x11,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   133
            (byte)0xB7, (byte)0x53, (byte)0x1B, (byte)0x3E,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   134
            (byte)0xB2, (byte)0x6B, (byte)0x0D, (byte)0x48,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   135
            (byte)0xD8, (byte)0x52, (byte)0x5A, (byte)0x4C,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   136
            (byte)0xBE, (byte)0x24, (byte)0xBB, (byte)0x3D,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   137
            (byte)0xC1, (byte)0x74, (byte)0x69, (byte)0xDA,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   138
            (byte)0x34, (byte)0x98, (byte)0x00, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   139
            (byte)0x00, (byte)0x26, (byte)0x00, (byte)0x01,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   140
            (byte)0x00, (byte)0x09, (byte)0x4D, (byte)0x41,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   141
            (byte)0x44, (byte)0x2E, (byte)0x4C, (byte)0x4F,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   142
            (byte)0x43, (byte)0x41, (byte)0x4C, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   143
            (byte)0x02, (byte)0x6D, (byte)0x65, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   144
            (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x4A,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   145
            (byte)0x79, (byte)0x51, (byte)0x27, (byte)0x03,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   146
            (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x08,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   147
            (byte)0xE6, (byte)0xB0, (byte)0x07, (byte)0xA8,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   148
            (byte)0x5B, (byte)0xF8, (byte)0x73, (byte)0xAD,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   149
            (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x2E,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   150
            (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x09,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   151
            (byte)0x4D, (byte)0x41, (byte)0x44, (byte)0x2E,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   152
            (byte)0x4C, (byte)0x4F, (byte)0x43, (byte)0x41,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   153
            (byte)0x4C, (byte)0x00, (byte)0x02, (byte)0x6D,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   154
            (byte)0x65, (byte)0x00, (byte)0x00, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   155
            (byte)0x00, (byte)0x4A, (byte)0x79, (byte)0x51,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   156
            (byte)0x27, (byte)0x03, (byte)0x00, (byte)0x11,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   157
            (byte)0x00, (byte)0x10, (byte)0xEA, (byte)0xF5,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   158
            (byte)0xA8, (byte)0x36, (byte)0xA5, (byte)0x3E,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   159
            (byte)0x5F, (byte)0x5C, (byte)0x26, (byte)0xE9,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   160
            (byte)0xDD, (byte)0x8B, (byte)0x8C, (byte)0xE8,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   161
            (byte)0x92, (byte)0x9C, (byte)0x00, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   162
            (byte)0x00, (byte)0x3E, (byte)0x00, (byte)0x01,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   163
            (byte)0x00, (byte)0x09, (byte)0x4D, (byte)0x41,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   164
            (byte)0x44, (byte)0x2E, (byte)0x4C, (byte)0x4F,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   165
            (byte)0x43, (byte)0x41, (byte)0x4C, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   166
            (byte)0x02, (byte)0x6D, (byte)0x65, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   167
            (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x4A,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   168
            (byte)0x79, (byte)0x51, (byte)0x27, (byte)0x03,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   169
            (byte)0x00, (byte)0x12, (byte)0x00, (byte)0x20,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   170
            (byte)0x68, (byte)0xBE, (byte)0xD4, (byte)0x17,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   171
            (byte)0x3A, (byte)0x06, (byte)0xE0, (byte)0x0C,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   172
            (byte)0x62, (byte)0x11, (byte)0xB7, (byte)0x53,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   173
            (byte)0x1B, (byte)0x3E, (byte)0xB2, (byte)0x6B,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   174
            (byte)0x0D, (byte)0x48, (byte)0xD8, (byte)0x52,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   175
            (byte)0x5A, (byte)0x4C, (byte)0xBE, (byte)0x24,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   176
            (byte)0xBB, (byte)0x3D, (byte)0xC1, (byte)0x74,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   177
            (byte)0x69, (byte)0xDA, (byte)0x34, (byte)0x98,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   178
            (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x26,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   179
            (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x09,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   180
            (byte)0x4D, (byte)0x41, (byte)0x44, (byte)0x2E,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   181
            (byte)0x4C, (byte)0x4F, (byte)0x43, (byte)0x41,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   182
            (byte)0x4C, (byte)0x00, (byte)0x02, (byte)0x68,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   183
            (byte)0x65, (byte)0x00, (byte)0x00, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   184
            (byte)0x00, (byte)0x4A, (byte)0x79, (byte)0x54,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   185
            (byte)0xC7, (byte)0x01, (byte)0x00, (byte)0x01,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   186
            (byte)0x00, (byte)0x08, (byte)0x85, (byte)0x5B,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   187
            (byte)0xE3, (byte)0x13, (byte)0x3E, (byte)0xF8,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   188
            (byte)0x76, (byte)0xEC, (byte)0x00, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   189
            (byte)0x00, (byte)0x2E, (byte)0x00, (byte)0x01,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   190
            (byte)0x00, (byte)0x09, (byte)0x4D, (byte)0x41,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   191
            (byte)0x44, (byte)0x2E, (byte)0x4C, (byte)0x4F,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   192
            (byte)0x43, (byte)0x41, (byte)0x4C, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   193
            (byte)0x02, (byte)0x68, (byte)0x65, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   194
            (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x4A,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   195
            (byte)0x79, (byte)0x54, (byte)0xC7, (byte)0x01,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   196
            (byte)0x00, (byte)0x11, (byte)0x00, (byte)0x10,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   197
            (byte)0xEC, (byte)0xCC, (byte)0x16, (byte)0xCD,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   198
            (byte)0xE8, (byte)0x51, (byte)0x46, (byte)0x4C,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   199
            (byte)0x1B, (byte)0x57, (byte)0xAE, (byte)0x19,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   200
            (byte)0xC3, (byte)0xD2, (byte)0x55, (byte)0x1B,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   201
            (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x3E,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   202
            (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x09,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   203
            (byte)0x4D, (byte)0x41, (byte)0x44, (byte)0x2E,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   204
            (byte)0x4C, (byte)0x4F, (byte)0x43, (byte)0x41,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   205
            (byte)0x4C, (byte)0x00, (byte)0x02, (byte)0x68,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   206
            (byte)0x65, (byte)0x00, (byte)0x00, (byte)0x00,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   207
            (byte)0x00, (byte)0x4A, (byte)0x79, (byte)0x54,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   208
            (byte)0xC7, (byte)0x01, (byte)0x00, (byte)0x12,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   209
            (byte)0x00, (byte)0x20, (byte)0xAE, (byte)0xBA,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   210
            (byte)0xCB, (byte)0xF5, (byte)0xA8, (byte)0x09,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   211
            (byte)0xC1, (byte)0xB0, (byte)0x2C, (byte)0x2A,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   212
            (byte)0x3D, (byte)0x96, (byte)0x2C, (byte)0x2D,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   213
            (byte)0xF5, (byte)0xFE, (byte)0x65, (byte)0xEC,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   214
            (byte)0x75, (byte)0x72, (byte)0x5B, (byte)0x46,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   215
            (byte)0x84, (byte)0xD7, (byte)0x49, (byte)0x3E,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   216
            (byte)0xF2, (byte)0x27, (byte)0x32, (byte)0x69,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   217
            (byte)0x75, (byte)0x9B,
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   218
        };
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   219
        System.setProperty("java.security.krb5.conf",
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   220
                new File(System.getProperty("test.src"),
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   221
                    "../krb5.conf").getAbsolutePath());
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   222
        FileOutputStream fout = new FileOutputStream("kt");
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   223
        fout.write(kt);
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   224
        fout.close();
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   225
        KeyTab ktab = KeyTab.getInstance("kt");
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   226
        PrincipalName pn = new PrincipalName("me@MAD.LOCAL");
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   227
        EncryptionKey[] keys = ktab.readServiceKeys(pn);
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   228
        if (keys[0].getKeyVersionNumber() != 5) {
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   229
            throw new Exception("Highest not first");
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   230
        }
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   231
        new File("kt").delete();
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   232
    }
78722c321f85 6867665: Problem with keytabs with multiple kvno's (key versions)
weijun
parents:
diff changeset
   233
}