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