Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/java/security/KeyRep/SerialOld.java
41152 views
1
/*
2
* Copyright (c) 2003, 2005, 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
/*
25
* @test 1.1, 03/08/13
26
* @bug 4532506
27
* @summary Serializing KeyPair on one VM (Sun),
28
* and Deserializing on another (IBM) fails
29
* @run main/othervm/java.security.policy=SerialOld.policy SerialOld
30
*/
31
32
import java.io.*;
33
import java.security.*;
34
35
public class SerialOld {
36
public static void main(String[] args) throws Exception {
37
38
// verify tiger DSA and RSA public keys still deserialize in our VM
39
40
deserializeTigerKey("DSA");
41
deserializeTigerKey("RSA");
42
43
// verify pre-tiger keys still deserialize in our VM
44
45
deserializeKey("DSA");
46
deserializeKey("RSA");
47
deserializeKey("DH");
48
deserializeKey("AES");
49
deserializeKey("Blowfish");
50
deserializeKey("DES");
51
deserializeKey("DESede");
52
deserializeKey("RC5");
53
deserializeKey("HmacSHA1");
54
deserializeKey("HmacMD5");
55
deserializeKey("PBE");
56
}
57
58
private static void deserializeTigerKey(String algorithm) throws Exception {
59
ObjectInputStream ois = new ObjectInputStream(new FileInputStream
60
(System.getProperty("test.src", ".") +
61
File.separator +
62
algorithm + ".1.5.key"));
63
ois.readObject();
64
ois.close();
65
}
66
private static void deserializeKey(String algorithm) throws Exception {
67
ObjectInputStream ois = new ObjectInputStream(new FileInputStream
68
(System.getProperty("test.src", ".") +
69
File.separator +
70
algorithm + ".pre.1.5.key"));
71
ois.readObject();
72
ois.close();
73
}
74
}
75
76