Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/sun/security/krb5/TestPAData.java
41152 views
1
/*
2
* Copyright (c) 2007, 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 6570062
26
* @summary Kerberos authentication regression
27
* @modules java.base/sun.security.util
28
* java.security.jgss/sun.security.krb5.internal
29
*/
30
31
import sun.security.krb5.internal.KRBError;
32
import sun.security.krb5.internal.Krb5;
33
import sun.security.util.DerValue;
34
35
public class TestPAData {
36
public static void main(String[] args) throws Exception {
37
// This is the dump of a KRB-ERROR data, no sensitive info included.
38
byte[] bytes = {
39
(byte)0X7E, (byte)0X71, (byte)0X30, (byte)0X6F,
40
(byte)0XA0, (byte)0X03, (byte)0X02, (byte)0X01,
41
(byte)0X05, (byte)0XA1, (byte)0X03, (byte)0X02,
42
(byte)0X01, (byte)0X1E, (byte)0XA4, (byte)0X11,
43
(byte)0X18, (byte)0X0F, (byte)0X32, (byte)0X30,
44
(byte)0X30, (byte)0X37, (byte)0X30, (byte)0X36,
45
(byte)0X32, (byte)0X31, (byte)0X32, (byte)0X31,
46
(byte)0X30, (byte)0X32, (byte)0X34, (byte)0X33,
47
(byte)0X5A, (byte)0XA5, (byte)0X05, (byte)0X02,
48
(byte)0X03, (byte)0X0A, (byte)0XC8, (byte)0XC5,
49
(byte)0XA6, (byte)0X03, (byte)0X02, (byte)0X01,
50
(byte)0X12, /* The errorcode at bytes[44] */
51
(byte)0XA9, (byte)0X0A, (byte)0X1B,
52
(byte)0X08, (byte)0X4E, (byte)0X33, (byte)0X2E,
53
(byte)0X4C, (byte)0X4F, (byte)0X43, (byte)0X41,
54
(byte)0X4C, (byte)0XAA, (byte)0X1D, (byte)0X30,
55
(byte)0X1B, (byte)0XA0, (byte)0X03, (byte)0X02,
56
(byte)0X01, (byte)0X02, (byte)0XA1, (byte)0X14,
57
(byte)0X30, (byte)0X12, (byte)0X1B, (byte)0X06,
58
(byte)0X6B, (byte)0X72, (byte)0X62, (byte)0X74,
59
(byte)0X67, (byte)0X74, (byte)0X1B, (byte)0X08,
60
(byte)0X4E, (byte)0X33, (byte)0X2E, (byte)0X4C,
61
(byte)0X4F, (byte)0X43, (byte)0X41, (byte)0X4C,
62
(byte)0XAC, (byte)0X19, (byte)0X04, (byte)0X17,
63
(byte)0X30, (byte)0X15, (byte)0XA1, (byte)0X03,
64
(byte)0X02, (byte)0X01, (byte)0X03, (byte)0XA2,
65
(byte)0X0E, (byte)0X04, (byte)0X0C, (byte)0X72,
66
(byte)0X00, (byte)0X00, (byte)0XC0, (byte)0X00,
67
(byte)0X00, (byte)0X00, (byte)0X00, (byte)0X01,
68
(byte)0X00, (byte)0X00, (byte)0X00
69
};
70
String err = "";
71
72
try {
73
new KRBError(new DerValue(bytes));
74
} catch (Exception e) {
75
err += "Test 1 fails.\n";
76
}
77
78
try {
79
bytes[44] = Krb5.KDC_ERR_PREAUTH_REQUIRED;
80
new KRBError(new DerValue(bytes));
81
err += "Test 2 fails.\n";
82
} catch (Exception e) {
83
// correct bahavior
84
}
85
if (err != "") {
86
throw new Exception(err);
87
}
88
}
89
}
90
91