8144480: Remove test dependencies on sun.misc.BASE64Encoder and BASE64Decoder
Reviewed-by: alanb, amlu, psandoz, weijun
This commit is contained in:
parent
00cf15a96c
commit
ebceee6674
jdk/test
com/sun
javax/net/ssl/TLSv12
sun/security
@ -26,16 +26,14 @@
|
||||
* @bug 5008159 5008156
|
||||
* @summary Verify that the two key wrap ciphers, i.e. "DESedeWrap"
|
||||
* and "AESWrap", work as expected.
|
||||
* @modules java.base/sun.misc
|
||||
* @run main XMLEncKAT
|
||||
* @author Valerie Peng
|
||||
*/
|
||||
import java.util.Base64;
|
||||
import java.security.Key;
|
||||
import java.security.AlgorithmParameters;
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.*;
|
||||
import sun.misc.BASE64Decoder;
|
||||
import sun.misc.BASE64Encoder;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.IOException;
|
||||
|
||||
@ -50,8 +48,8 @@ public class XMLEncKAT {
|
||||
private static byte[] aes192Key_2;
|
||||
private static byte[] aes256Key_2;
|
||||
|
||||
private static BASE64Decoder base64D = new BASE64Decoder();
|
||||
private static BASE64Encoder base64E = new BASE64Encoder();
|
||||
private static Base64.Decoder base64D = Base64.getDecoder();
|
||||
private static Base64.Encoder base64E = Base64.getEncoder();
|
||||
|
||||
static {
|
||||
try {
|
||||
@ -62,18 +60,16 @@ public class XMLEncKAT {
|
||||
} catch (UnsupportedEncodingException uee) {
|
||||
// should never happen
|
||||
}
|
||||
try {
|
||||
desEdeKey_2 = base64D.decodeBuffer
|
||||
("yI+J1f3puYAERjIcT6vfg6RitmKX8nD0");
|
||||
aes128Key_2 = base64D.decodeBuffer
|
||||
("01+yuQ2huPS1+Qv0LH+zaQ==");
|
||||
aes192Key_2 = base64D.decodeBuffer
|
||||
("IlfuS40LvStVU0Mj8ePrrGHVhAb48y++");
|
||||
aes256Key_2 = base64D.decodeBuffer
|
||||
("ZhZ4v3RlwTlCEOpIrHfLKVyJOBDtEJOOQDat/4xR1bA=");
|
||||
} catch (IOException ioe) {
|
||||
// should never happen
|
||||
}
|
||||
|
||||
desEdeKey_2 = base64D.decode
|
||||
("yI+J1f3puYAERjIcT6vfg6RitmKX8nD0");
|
||||
aes128Key_2 = base64D.decode
|
||||
("01+yuQ2huPS1+Qv0LH+zaQ==");
|
||||
aes192Key_2 = base64D.decode
|
||||
("IlfuS40LvStVU0Mj8ePrrGHVhAb48y++");
|
||||
aes256Key_2 = base64D.decode
|
||||
("ZhZ4v3RlwTlCEOpIrHfLKVyJOBDtEJOOQDat/4xR1bA=");
|
||||
|
||||
}
|
||||
private static String[] desEdeWrappedKey_1 = {
|
||||
"ZyJbVsjRM4MEsswwwHz57aUz1eMqZHuEIoEPGS47CcmLvhuCtlzWZ9S/WcVJZIpz",
|
||||
@ -123,7 +119,7 @@ public class XMLEncKAT {
|
||||
new IvParameterSpec[base64Wrapped.length];
|
||||
// first test UNWRAP with known values
|
||||
for (int i = 0; i < base64Wrapped.length; i++) {
|
||||
byte[] wrappedKey = base64D.decodeBuffer(base64Wrapped[i]);
|
||||
byte[] wrappedKey = base64D.decode(base64Wrapped[i]);
|
||||
key[i] = c.unwrap(wrappedKey, "AES", Cipher.SECRET_KEY);
|
||||
if (c.getIV() != null) {
|
||||
params[i] = new IvParameterSpec(c.getIV());
|
||||
@ -133,7 +129,7 @@ public class XMLEncKAT {
|
||||
for (int i = 0; i < key.length; i++) {
|
||||
c.init(Cipher.WRAP_MODE, cKey, params[i]);
|
||||
byte[] wrapped2 = c.wrap(key[i]);
|
||||
String out = base64E.encode(wrapped2);
|
||||
String out = base64E.encodeToString(wrapped2);
|
||||
if (!out.equalsIgnoreCase(base64Wrapped[i])) {
|
||||
throw new Exception("Wrap failed; got " + out + ", expect " +
|
||||
base64Wrapped[i]);
|
||||
|
@ -25,7 +25,6 @@
|
||||
* @test
|
||||
* @bug 8035807
|
||||
* @summary Confirm that old and new Base64 encodings are compatible.
|
||||
* @modules java.base/sun.misc
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
@ -33,8 +32,6 @@ import java.util.*;
|
||||
import javax.naming.*;
|
||||
import javax.naming.directory.*;
|
||||
|
||||
import sun.misc.BASE64Decoder;
|
||||
|
||||
/*
|
||||
* RFC 2713 specifies an encoding for Java objects stored in an LDAP directory.
|
||||
* Section 3.6 specifies how a binary-valued JNDI RefAddr object is encoded
|
||||
@ -48,12 +45,10 @@ import sun.misc.BASE64Decoder;
|
||||
* as the line separator. It is a compatible change.
|
||||
*
|
||||
* This test demonstrates that there is no compatability problem when
|
||||
* encoding and decoding using either Base64 coder:
|
||||
* decoding using the new Base64 coder:
|
||||
*
|
||||
* encode with s.m.BASE64Encoder, decode with s.m.BASE64Decoder => OK
|
||||
* encode with s.m.BASE64Encoder, decode with j.u.Base64.Decoder => OK
|
||||
* encode with j.u.Base64.Encoder, decode with s.m.BASE64Decoder => OK
|
||||
* encode with j.u.Base64.Encoder, decode with j.u.Base64.Decoder => OK
|
||||
* encoded bytes captured from s.m.BASE64Encoder, decode with j.u.Base64.Decoder => OK
|
||||
* encoded bytes captured from j.u.Base64.Encoder, decode with j.u.Base64.Decoder => OK
|
||||
*
|
||||
*
|
||||
* NOTE: The two Base64 encodings used in this test were captured from
|
||||
@ -148,25 +143,9 @@ public class Base64Test {
|
||||
|
||||
System.out.println("\nOriginal RefAddr object:\n" + BINARY_REF_ADDR);
|
||||
System.out.println("Old Base64 encoded serialized RefAddr object:\n" +
|
||||
OLD_ENCODING);
|
||||
System.out.println("Decode using old Base64 decoder...");
|
||||
deserialize(new BASE64Decoder().decodeBuffer(OLD_ENCODING));
|
||||
|
||||
System.out.println("----");
|
||||
|
||||
System.out.println("\nOriginal RefAddr object:\n" + BINARY_REF_ADDR);
|
||||
System.out.println("Old Base64 encoded serialized RefAddr object:\n" +
|
||||
OLD_ENCODING);
|
||||
OLD_ENCODING + "\n");
|
||||
System.out.println("Decode using new Base64 decoder...");
|
||||
deserialize(new BASE64Decoder().decodeBuffer(OLD_ENCODING));
|
||||
|
||||
System.out.println("----");
|
||||
|
||||
System.out.println("\nOriginal RefAddr object:\n" + BINARY_REF_ADDR);
|
||||
System.out.println("New Base64 encoded serialized RefAddr object:\n" +
|
||||
NEW_ENCODING + "\n");
|
||||
System.out.println("Decode using old Base64 decoder...");
|
||||
deserialize(new BASE64Decoder().decodeBuffer(OLD_ENCODING));
|
||||
deserialize(Base64.getMimeDecoder().decode(OLD_ENCODING));
|
||||
|
||||
System.out.println("----");
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
* @test
|
||||
* @bug 7030966
|
||||
* @summary Support AEAD CipherSuites
|
||||
* @modules java.base/sun.misc
|
||||
* @run main/othervm ShortRSAKeyGCM PKIX TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
|
||||
* @run main/othervm ShortRSAKeyGCM PKIX TLS_RSA_WITH_AES_128_GCM_SHA256
|
||||
* @run main/othervm ShortRSAKeyGCM PKIX TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
|
||||
@ -69,7 +68,6 @@ import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.spec.*;
|
||||
import java.security.interfaces.*;
|
||||
import sun.misc.BASE64Decoder;
|
||||
|
||||
|
||||
public class ShortRSAKeyGCM {
|
||||
@ -252,7 +250,7 @@ public class ShortRSAKeyGCM {
|
||||
if (keyCertStr != null) {
|
||||
// generate the private key.
|
||||
PKCS8EncodedKeySpec priKeySpec = new PKCS8EncodedKeySpec(
|
||||
new BASE64Decoder().decodeBuffer(keySpecStr));
|
||||
Base64.getMimeDecoder().decode(keySpecStr));
|
||||
KeyFactory kf = KeyFactory.getInstance("RSA");
|
||||
RSAPrivateKey priKey =
|
||||
(RSAPrivateKey)kf.generatePrivate(priKeySpec);
|
||||
|
@ -24,8 +24,7 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 4811968 6908628 8006564 8130696
|
||||
* @modules java.base/sun.misc
|
||||
* java.base/sun.security.util
|
||||
* @modules java.base/sun.security.util
|
||||
* @run main S11N check
|
||||
* @summary Serialization compatibility with old versions (and fixes)
|
||||
*/
|
||||
@ -36,7 +35,6 @@ import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import sun.misc.BASE64Encoder;
|
||||
import sun.security.util.ObjectIdentifier;
|
||||
|
||||
public class S11N {
|
||||
@ -56,14 +54,6 @@ public class S11N {
|
||||
"1.2.8888888888888888.33333333333333333.44444444444444",
|
||||
};
|
||||
|
||||
// Do not use j.u.Base64, the test needs to run in jdk6
|
||||
static BASE64Encoder encoder = new BASE64Encoder() {
|
||||
@Override
|
||||
protected int bytesPerLine() {
|
||||
return 48;
|
||||
}
|
||||
};
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
if (args[0].equals("check")) {
|
||||
String jv = System.getProperty("java.version");
|
||||
@ -117,12 +107,12 @@ public class S11N {
|
||||
|
||||
// Gets the serialized form for jdk6
|
||||
private static byte[] out6(String oid) throws Exception {
|
||||
return new sun.misc.BASE64Decoder().decodeBuffer(dump6.get(oid));
|
||||
return decode(dump6.get(oid));
|
||||
}
|
||||
|
||||
// Gets the serialized form for jdk7
|
||||
private static byte[] out7(String oid) throws Exception {
|
||||
return new sun.misc.BASE64Decoder().decodeBuffer(dump7.get(oid));
|
||||
return decode(dump7.get(oid));
|
||||
}
|
||||
|
||||
// Gets the serialized form for this java
|
||||
@ -144,11 +134,15 @@ public class S11N {
|
||||
// dump serialized form to java code style text
|
||||
private static void dump(String title, String[] oids) throws Exception {
|
||||
for (String oid: oids) {
|
||||
String[] base64 = encoder.encodeBuffer(out(oid)).split("\n");
|
||||
String hex = encode(out(oid));
|
||||
System.out.println(" " + title + ".put(\"" + oid + "\",");
|
||||
for (int i = 0; i<base64.length; i++) {
|
||||
System.out.print(" \"" + base64[i] + "\"");
|
||||
if (i == base64.length - 1) {
|
||||
for (int i = 0; i<hex.length(); i+= 64) {
|
||||
int end = i + 64;
|
||||
if (end > hex.length()) {
|
||||
end = hex.length();
|
||||
}
|
||||
System.out.print(" \"" + hex.substring(i, end) + "\"");
|
||||
if (end == hex.length()) {
|
||||
System.out.println(");");
|
||||
} else {
|
||||
System.out.println(" +");
|
||||
@ -157,6 +151,22 @@ public class S11N {
|
||||
}
|
||||
}
|
||||
|
||||
private static String encode(byte[] bytes) {
|
||||
StringBuilder sb = new StringBuilder(bytes.length * 2);
|
||||
for (byte b: bytes) {
|
||||
sb.append(String.format("%02x", b & 0xff));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static byte[] decode(String var) {
|
||||
byte[] data = new byte[var.length()/2];
|
||||
for (int i=0; i<data.length; i++) {
|
||||
data[i] = Integer.valueOf(var.substring(2 * i, 2 * i + 2), 16).byteValue();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
// Do not use diamond operator, this test is also meant to run in jdk6
|
||||
private static Map<String,String> dump7 = new HashMap<String,String>();
|
||||
private static Map<String,String> dump6 = new HashMap<String,String>();
|
||||
@ -164,88 +174,119 @@ public class S11N {
|
||||
static {
|
||||
////////////// PASTE BEGIN //////////////
|
||||
dump7.put("0.0",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
|
||||
"YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAAAnVyAAJbSU26YCZ26rKlAgAAeHAA" +
|
||||
"AAACAAAAAAAAAAB1cgACW0Ks8xf4BghU4AIAAHhwAAAAAQB4");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
|
||||
"744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
|
||||
"626a6563743b5b0008656e636f64696e677400025b4278700000000275720002" +
|
||||
"5b494dba602676eab2a50200007870000000020000000000000000757200025b" +
|
||||
"42acf317f8060854e00200007870000000010078");
|
||||
dump7.put("1.1",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
|
||||
"YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAAAnVyAAJbSU26YCZ26rKlAgAAeHAA" +
|
||||
"AAACAAAAAQAAAAF1cgACW0Ks8xf4BghU4AIAAHhwAAAAASl4");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
|
||||
"744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
|
||||
"626a6563743b5b0008656e636f64696e677400025b4278700000000275720002" +
|
||||
"5b494dba602676eab2a50200007870000000020000000100000001757200025b" +
|
||||
"42acf317f8060854e00200007870000000012978");
|
||||
dump7.put("2.2",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
|
||||
"YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAAAnVyAAJbSU26YCZ26rKlAgAAeHAA" +
|
||||
"AAACAAAAAgAAAAJ1cgACW0Ks8xf4BghU4AIAAHhwAAAAAVJ4");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
|
||||
"744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
|
||||
"626a6563743b5b0008656e636f64696e677400025b4278700000000275720002" +
|
||||
"5b494dba602676eab2a50200007870000000020000000200000002757200025b" +
|
||||
"42acf317f8060854e00200007870000000015278");
|
||||
dump7.put("1.2.3456",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
|
||||
"YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAAA3VyAAJbSU26YCZ26rKlAgAAeHAA" +
|
||||
"AAADAAAAAQAAAAIAAA2AdXIAAltCrPMX+AYIVOACAAB4cAAAAAMqmwB4");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
|
||||
"744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
|
||||
"626a6563743b5b0008656e636f64696e677400025b4278700000000375720002" +
|
||||
"5b494dba602676eab2a5020000787000000003000000010000000200000d8075" +
|
||||
"7200025b42acf317f8060854e00200007870000000032a9b0078");
|
||||
dump7.put("1.2.2147483647.4",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
|
||||
"YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAABHVyAAJbSU26YCZ26rKlAgAAeHAA" +
|
||||
"AAAEAAAAAQAAAAJ/////AAAABHVyAAJbQqzzF/gGCFTgAgAAeHAAAAAHKof///9/" +
|
||||
"BHg=");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
|
||||
"744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
|
||||
"626a6563743b5b0008656e636f64696e677400025b4278700000000475720002" +
|
||||
"5b494dba602676eab2a502000078700000000400000001000000027fffffff00" +
|
||||
"000004757200025b42acf317f8060854e00200007870000000072a87ffffff7f" +
|
||||
"0478");
|
||||
dump7.put("1.2.268435456.4",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
|
||||
"YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAABHVyAAJbSU26YCZ26rKlAgAAeHAA" +
|
||||
"AAAEAAAAAQAAAAIQAAAAAAAABHVyAAJbQqzzF/gGCFTgAgAAeHAAAAAHKoGAgIAA" +
|
||||
"BHg=");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
|
||||
"744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
|
||||
"626a6563743b5b0008656e636f64696e677400025b4278700000000475720002" +
|
||||
"5b494dba602676eab2a502000078700000000400000001000000021000000000" +
|
||||
"000004757200025b42acf317f8060854e00200007870000000072a8180808000" +
|
||||
"0478");
|
||||
dump7.put("2.16.764.1.3101555394.1.0.100.2.1",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
|
||||
"YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhw/////3NyAD5zdW4uc2VjdXJpdHkudXRp" +
|
||||
"bC5PYmplY3RJZGVudGlmaWVyJEh1Z2VPaWROb3RTdXBwb3J0ZWRCeU9sZEpESwAA" +
|
||||
"AAAAAAABAgAAeHB1cgACW0Ks8xf4BghU4AIAAHhwAAAADmCFfAGLxvf1QgEAZAIB" +
|
||||
"eA==");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
|
||||
"744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
|
||||
"626a6563743b5b0008656e636f64696e677400025b427870ffffffff7372003e" +
|
||||
"73756e2e73656375726974792e7574696c2e4f626a6563744964656e74696669" +
|
||||
"657224487567654f69644e6f74537570706f7274656442794f6c644a444b0000" +
|
||||
"0000000000010200007870757200025b42acf317f8060854e002000078700000" +
|
||||
"000e60857c018bc6f7f542010064020178");
|
||||
dump7.put("1.2.2147483648.4",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
|
||||
"YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhw/////3NyAD5zdW4uc2VjdXJpdHkudXRp" +
|
||||
"bC5PYmplY3RJZGVudGlmaWVyJEh1Z2VPaWROb3RTdXBwb3J0ZWRCeU9sZEpESwAA" +
|
||||
"AAAAAAABAgAAeHB1cgACW0Ks8xf4BghU4AIAAHhwAAAAByqIgICAAAR4");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
|
||||
"744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
|
||||
"626a6563743b5b0008656e636f64696e677400025b427870ffffffff7372003e" +
|
||||
"73756e2e73656375726974792e7574696c2e4f626a6563744964656e74696669" +
|
||||
"657224487567654f69644e6f74537570706f7274656442794f6c644a444b0000" +
|
||||
"0000000000010200007870757200025b42acf317f8060854e002000078700000" +
|
||||
"00072a88808080000478");
|
||||
dump7.put("2.3.4444444444444444444444",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
|
||||
"YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhw/////3NyAD5zdW4uc2VjdXJpdHkudXRp" +
|
||||
"bC5PYmplY3RJZGVudGlmaWVyJEh1Z2VPaWROb3RTdXBwb3J0ZWRCeU9sZEpESwAA" +
|
||||
"AAAAAAABAgAAeHB1cgACW0Ks8xf4BghU4AIAAHhwAAAADFOD4e+HpNG968eOHHg=");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
|
||||
"744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
|
||||
"626a6563743b5b0008656e636f64696e677400025b427870ffffffff7372003e" +
|
||||
"73756e2e73656375726974792e7574696c2e4f626a6563744964656e74696669" +
|
||||
"657224487567654f69644e6f74537570706f7274656442794f6c644a444b0000" +
|
||||
"0000000000010200007870757200025b42acf317f8060854e002000078700000" +
|
||||
"000c5383e1ef87a4d1bdebc78e1c78");
|
||||
dump7.put("1.2.8888888888888888.33333333333333333.44444444444444",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
|
||||
"YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhw/////3NyAD5zdW4uc2VjdXJpdHkudXRp" +
|
||||
"bC5PYmplY3RJZGVudGlmaWVyJEh1Z2VPaWROb3RTdXBwb3J0ZWRCeU9sZEpESwAA" +
|
||||
"AAAAAAABAgAAeHB1cgACW0Ks8xf4BghU4AIAAHhwAAAAGCqP5Yzbxa6cOLubj9ek" +
|
||||
"japVio3AusuOHHg=");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
|
||||
"744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
|
||||
"626a6563743b5b0008656e636f64696e677400025b427870ffffffff7372003e" +
|
||||
"73756e2e73656375726974792e7574696c2e4f626a6563744964656e74696669" +
|
||||
"657224487567654f69644e6f74537570706f7274656442794f6c644a444b0000" +
|
||||
"0000000000010200007870757200025b42acf317f8060854e002000078700000" +
|
||||
"00182a8fe58cdbc5ae9c38bb9b8fd7a48daa558a8dc0bacb8e1c78");
|
||||
|
||||
dump6.put("0.0",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAJ1cgAC" +
|
||||
"W0lNumAmduqypQIAAHhwAAAAAgAAAAAAAAAA");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e02000249000c636f6d706f6e656e" +
|
||||
"744c656e5b000a636f6d706f6e656e74737400025b4978700000000275720002" +
|
||||
"5b494dba602676eab2a50200007870000000020000000000000000");
|
||||
dump6.put("1.1",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAJ1cgAC" +
|
||||
"W0lNumAmduqypQIAAHhwAAAAAgAAAAEAAAAB");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e02000249000c636f6d706f6e656e" +
|
||||
"744c656e5b000a636f6d706f6e656e74737400025b4978700000000275720002" +
|
||||
"5b494dba602676eab2a50200007870000000020000000100000001");
|
||||
dump6.put("2.2",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAJ1cgAC" +
|
||||
"W0lNumAmduqypQIAAHhwAAAAAgAAAAIAAAAC");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e02000249000c636f6d706f6e656e" +
|
||||
"744c656e5b000a636f6d706f6e656e74737400025b4978700000000275720002" +
|
||||
"5b494dba602676eab2a50200007870000000020000000200000002");
|
||||
dump6.put("1.2.3456",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAN1cgAC" +
|
||||
"W0lNumAmduqypQIAAHhwAAAAAwAAAAEAAAACAAANgA==");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e02000249000c636f6d706f6e656e" +
|
||||
"744c656e5b000a636f6d706f6e656e74737400025b4978700000000375720002" +
|
||||
"5b494dba602676eab2a5020000787000000003000000010000000200000d80");
|
||||
dump6.put("1.2.2147483647.4",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAR1cgAC" +
|
||||
"W0lNumAmduqypQIAAHhwAAAABAAAAAEAAAACf////wAAAAQ=");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e02000249000c636f6d706f6e656e" +
|
||||
"744c656e5b000a636f6d706f6e656e74737400025b4978700000000475720002" +
|
||||
"5b494dba602676eab2a502000078700000000400000001000000027fffffff00" +
|
||||
"000004");
|
||||
dump6.put("1.2.268435456.4",
|
||||
"rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
|
||||
"fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAR1cgAC" +
|
||||
"W0lNumAmduqypQIAAHhwAAAABAAAAAEAAAACEAAAAAAAAAQ=");
|
||||
"aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
|
||||
"4964656e74696669657278b20eec64177f2e02000249000c636f6d706f6e656e" +
|
||||
"744c656e5b000a636f6d706f6e656e74737400025b4978700000000475720002" +
|
||||
"5b494dba602676eab2a502000078700000000400000001000000021000000000" +
|
||||
"000004");
|
||||
|
||||
////////////// PASTE END //////////////
|
||||
}
|
||||
}
|
||||
|
@ -42,10 +42,10 @@ import java.security.SignatureException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Base64;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
import sun.misc.BASE64Encoder;
|
||||
import sun.security.util.BitArray;
|
||||
import sun.security.util.ObjectIdentifier;
|
||||
import sun.security.x509.*;
|
||||
@ -55,7 +55,6 @@ import sun.security.x509.*;
|
||||
* @bug 8049237
|
||||
* @modules java.base/sun.security.x509
|
||||
* java.base/sun.security.util
|
||||
* java.base/sun.misc
|
||||
* @summary This test generates V3 certificate with all the supported
|
||||
* extensions. Writes back the generated certificate in to a file and checks for
|
||||
* equality with the original certificate.
|
||||
@ -224,7 +223,7 @@ public class V3Certificate {
|
||||
// Certificate boundaries/
|
||||
pw.println("-----BEGIN CERTIFICATE-----");
|
||||
pw.flush();
|
||||
new BASE64Encoder().encodeBuffer(crt.getEncoded(), fos_b64);
|
||||
fos_b64.write(Base64.getMimeEncoder().encode(crt.getEncoded()));
|
||||
fos_b64.flush();
|
||||
pw.println("-----END CERTIFICATE-----");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user