test/jdk/sun/security/tools/keytool/RealType.java
changeset 59104 046e4024e55a
parent 48216 e3b6cb90d7ce
equal deleted inserted replaced
59103:4a09d4df104c 59104:046e4024e55a
     1 /*
     1 /*
     2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2017, 2019, 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.
    43 
    43 
    44 public class RealType {
    44 public class RealType {
    45 
    45 
    46     public static void main(String[] args) throws Throwable {
    46     public static void main(String[] args) throws Throwable {
    47 
    47 
    48         kt("-genkeypair -alias a -dname CN=A -keypass changeit -storetype jks")
    48         kt("-genkeypair -keyalg DSA -alias a -dname CN=A -keypass changeit -storetype jks")
    49                 .shouldHaveExitValue(0);
    49                 .shouldHaveExitValue(0);
    50 
    50 
    51         // -keypasswd command should be allowed on JKS
    51         // -keypasswd command should be allowed on JKS
    52         kt("-keypasswd -alias a -new t0ps3cr3t")
    52         kt("-keypasswd -alias a -new t0ps3cr3t")
    53                 .shouldHaveExitValue(0);
    53                 .shouldHaveExitValue(0);
    54 
    54 
    55         Files.delete(Paths.get("ks"));
    55         Files.delete(Paths.get("ks"));
    56 
    56 
    57         kt("-genkeypair -alias a -dname CN=A -keypass changeit -storetype pkcs12")
    57         kt("-genkeypair -keyalg DSA -alias a -dname CN=A -keypass changeit -storetype pkcs12")
    58                 .shouldHaveExitValue(0);
    58                 .shouldHaveExitValue(0);
    59 
    59 
    60         // A pkcs12 keystore cannot be loaded as a JCEKS keystore
    60         // A pkcs12 keystore cannot be loaded as a JCEKS keystore
    61         kt("-list -storetype jceks").shouldHaveExitValue(1);
    61         kt("-list -storetype jceks").shouldHaveExitValue(1);
    62     }
    62     }