Path: blob/master/test/jdk/sun/security/tools/keytool/StandardAlgName.java
41152 views
/*1* Copyright (c) 2004, 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 490988926* @summary KeyTool accepts any input that user make as long as we can make some27* sense out of it, but when comes to present the info the user, it28* promotes a standard look.29* @author Andrew Fan30* @library /test/lib31* @run main/timeout=240 StandardAlgName32*/3334import jdk.test.lib.SecurityTools;3536public class StandardAlgName {37public static void main(String[] args) throws Exception {38// CA39SecurityTools.keytool("-genkey", "-v", "-alias", "pkcs12testCA",40"-keyalg", "RsA", "-keysize", "2048",41"-sigalg", "ShA1wItHRSA",42"-dname", "cn=PKCS12 Test CA, ou = Security SQE, o = JavaSoft, c = US",43"-validity", "3650",44"-keypass", "storepass", "-keystore", "keystoreCA.jceks.data",45"-storepass", "storepass", "-storetype", "jceKS")46.shouldHaveExitValue(0)47.shouldNotContain("RsA")48.shouldNotContain("ShA1wItHRSA")49.shouldContain("RSA")50.shouldContain("SHA1withRSA");5152// Lead53SecurityTools.keytool("-genkey", "-v", "-alias", "pkcs12testLead",54"-keyalg", "rSA", "-keysize", "1024",55"-sigalg", "mD5withRSA",56"-dname", "cn=PKCS12 Test Lead, ou=Security SQE, o=JavaSoft, c=US",57"-validity", "3650",58"-keypass", "storepass", "-keystore", "keystoreLead.jceks.data",59"-storepass", "storepass", "-storetype", "jCeks")60.shouldHaveExitValue(0)61.shouldNotContain("rSA")62.shouldNotContain("mD5withRSA")63.shouldContain("RSA")64.shouldContain("MD5withRSA");6566// End User 167SecurityTools.keytool("-genkey", "-v", "-alias", "pkcs12testEndUser1",68"-keyalg", "RSa", "-keysize", "1024",69"-sigalg", "sHa1wIThRSA",70"-dname", "cn=PKCS12 Test End User 1, ou=Security SQE, o=JavaSoft, c=US",71"-validity", "3650",72"-keypass", "storepass", "-keystore", "keystoreEndUser1.jceks.data",73"-storepass", "storepass", "-storetype", "Jceks")74.shouldHaveExitValue(0)75.shouldNotContain("RSa")76.shouldNotContain("sHa1wIThRSA")77.shouldContain("RSA")78.shouldContain("SHA1withRSA");79}80}818283