Path: blob/master/test/jdk/sun/security/tools/jarsigner/Crl.java
41152 views
/*1* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 6890876 695093126* @summary jarsigner can add CRL info into signed jar (updated)27* @library /test/lib28*/2930import jdk.test.lib.SecurityTools;31import jdk.test.lib.process.OutputAnalyzer;3233public class Crl {34static OutputAnalyzer kt(String cmd) throws Exception {35return SecurityTools.keytool("-storepass changeit -keypass changeit "36+ "-keystore ks -keyalg rsa " + cmd);37}3839public static void main(String[] args) throws Exception {40kt("-alias a -dname CN=a -keyalg rsa -genkey -validity 300");41kt("-alias a -gencrl -id 1:1 -id 2:2 -file crl1")42.shouldHaveExitValue(0);43kt("-alias a -gencrl -id 3:3 -id 4:4 -file crl2")44.shouldHaveExitValue(0);45kt("-alias a -gencrl -id 5:1 -id 6:2 -file crl3")46.shouldHaveExitValue(0);4748// Test keytool -printcrl4950kt("-printcrl -file crl1").shouldHaveExitValue(0);51kt("-printcrl -file crl2").shouldHaveExitValue(0);52kt("-printcrl -file crl3").shouldHaveExitValue(0);5354// Test keytool -ext crl5556kt("-alias b -dname CN=c -keyalg rsa -genkey -validity 300 "57+ "-ext crl=uri:http://www.example.com/crl")58.shouldHaveExitValue(0);59}60}616263