< prev index next >

test/jdk/sun/security/tools/jarsigner/warnings/ChainNotValidatedTest.java

Print this page
rev 51638 : [mq]: 8210112


   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 import jdk.testlibrary.OutputAnalyzer;
  25 import jdk.test.lib.util.JarUtils;
  26 
  27 import java.nio.file.Files;
  28 import java.nio.file.Paths;
  29 
  30 /**
  31  * @test
  32  * @bug 8024302 8026037
  33  * @summary Test for chainNotValidated warning
  34  * @library /lib/testlibrary /test/lib ../
  35  * @build jdk.test.lib.util.JarUtils
  36  * @run main ChainNotValidatedTest ca2yes
  37  * @run main ChainNotValidatedTest ca2no
  38  */
  39 public class ChainNotValidatedTest extends Test {
  40 
  41     public static void main(String[] args) throws Throwable {
  42         ChainNotValidatedTest test = new ChainNotValidatedTest();
  43         test.start(args[0].equals("ca2yes"));
  44     }
  45 
  46     private void start(boolean ca2yes) throws Throwable {
  47         // create a jar file that contains one class file
  48         Utils.createFiles(FIRST_FILE);
  49         JarUtils.createJar(UNSIGNED_JARFILE, FIRST_FILE);
  50 
  51         // We have 2 @run. Need cleanup.
  52         Files.deleteIfExists(Paths.get(KEYSTORE));
  53 
  54         // Root CA is not checked at all. If the intermediate CA has




   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 import jdk.test.lib.process.OutputAnalyzer;
  25 import jdk.test.lib.util.JarUtils;
  26 
  27 import java.nio.file.Files;
  28 import java.nio.file.Paths;
  29 
  30 /**
  31  * @test
  32  * @bug 8024302 8026037
  33  * @summary Test for chainNotValidated warning
  34  * @library /test/lib ../
  35  * @build jdk.test.lib.util.JarUtils
  36  * @run main ChainNotValidatedTest ca2yes
  37  * @run main ChainNotValidatedTest ca2no
  38  */
  39 public class ChainNotValidatedTest extends Test {
  40 
  41     public static void main(String[] args) throws Throwable {
  42         ChainNotValidatedTest test = new ChainNotValidatedTest();
  43         test.start(args[0].equals("ca2yes"));
  44     }
  45 
  46     private void start(boolean ca2yes) throws Throwable {
  47         // create a jar file that contains one class file
  48         Utils.createFiles(FIRST_FILE);
  49         JarUtils.createJar(UNSIGNED_JARFILE, FIRST_FILE);
  50 
  51         // We have 2 @run. Need cleanup.
  52         Files.deleteIfExists(Paths.get(KEYSTORE));
  53 
  54         // Root CA is not checked at all. If the intermediate CA has


< prev index next >