jdk/test/sun/security/provider/certpath/ReverseBuilder/ReverseBuild.java
changeset 22268 d72c97c708ae
parent 12693 e3c056161305
equal deleted inserted replaced
22267:13f418b13938 22268:d72c97c708ae
     1 /*
     1 /*
     2  * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    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
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
       
    24 //
       
    25 // Security properties, once set, cannot revert to unset.  To avoid
       
    26 // conflicts with tests running in the same VM isolate this test by
       
    27 // running it in otherVM mode.
       
    28 //
       
    29 
    24 /*
    30 /*
    25  * @test
    31  * @test
    26  * @bug 7167988
    32  * @bug 7167988
    27  * @summary PKIX CertPathBuilder in reverse mode doesn't work if more than
    33  * @summary PKIX CertPathBuilder in reverse mode doesn't work if more than
    28  *          one trust anchor is specified
    34  *          one trust anchor is specified
       
    35  * @run main/othervm ReverseBuild
    29  */
    36  */
    30 import java.io.*;
    37 import java.io.*;
    31 import java.util.*;
    38 import java.util.*;
    32 import java.security.cert.*;
    39 import java.security.cert.*;
       
    40 import java.security.Security;
    33 
    41 
    34 import sun.security.provider.certpath.SunCertPathBuilderParameters;
    42 import sun.security.provider.certpath.SunCertPathBuilderParameters;
    35 
    43 
    36 public class ReverseBuild {
    44 public class ReverseBuild {
    37     // Certificate information:
    45     // Certificate information:
   277         "j6JTa2KAdqyvLOx0XF9zcc1gA069uNQI2gPUHS8V215z57f/gMGnDNhVfLs/vMKz\n" +
   285         "j6JTa2KAdqyvLOx0XF9zcc1gA069uNQI2gPUHS8V215z57f/gMGnDNhVfLs/vMKz\n" +
   278         "sFkVZ3zg7As=";
   286         "sFkVZ3zg7As=";
   279 
   287 
   280 
   288 
   281     public static void main(String args[]) throws Exception {
   289     public static void main(String args[]) throws Exception {
       
   290         // MD5 is used in this test case, don't disable MD5 algorithm.
       
   291         Security.setProperty(
       
   292                 "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
   282 
   293 
   283         // generate certificate from cert string
   294         // generate certificate from cert string
   284         CertificateFactory cf = CertificateFactory.getInstance("X.509");
   295         CertificateFactory cf = CertificateFactory.getInstance("X.509");
   285 
   296 
   286         // create a set of trust anchors
   297         // create a set of trust anchors