jdk/test/sun/security/tools/keytool/KeyToolTest.java
changeset 14182 3041082abb40
parent 12871 b583b4c82a82
child 27344 890be6336eab
equal deleted inserted replaced
14181:f723098d438c 14182:3041082abb40
    54  * ATTENTION:
    54  * ATTENTION:
    55  * NSS PKCS11 config file are changed, DSA not supported now.
    55  * NSS PKCS11 config file are changed, DSA not supported now.
    56  */
    56  */
    57 
    57 
    58 import java.security.KeyStore;
    58 import java.security.KeyStore;
    59 import sun.security.tools.KeyTool;
       
    60 import sun.security.x509.*;
    59 import sun.security.x509.*;
    61 import java.io.*;
    60 import java.io.*;
    62 import java.security.KeyPairGenerator;
    61 import java.security.KeyPairGenerator;
    63 import java.security.NoSuchAlgorithmException;
    62 import java.security.NoSuchAlgorithmException;
    64 import java.util.*;
    63 import java.util.*;
   147         try {
   146         try {
   148             System.setIn(in);
   147             System.setIn(in);
   149             System.setOut(new PrintStream(b1));
   148             System.setOut(new PrintStream(b1));
   150             System.setErr(new PrintStream(b2));
   149             System.setErr(new PrintStream(b2));
   151 
   150 
   152             // since System.in is overrided, the KeyTool.main() method will
   151             // since System.in is overrided, the
       
   152             // sun.security.tools.keytool.Main.main() method will
   153             // never block at user input
   153             // never block at user input
   154 
   154 
   155             // use -debug so that KeyTool.main() will throw an Exception
   155             // use -debug so that main() will throw an Exception
   156             // instead of calling System.exit()
   156             // instead of calling System.exit()
   157             KeyTool.main(("-debug "+cmd).split("\\s+"));
   157             sun.security.tools.keytool.Main.main(("-debug "+cmd).split("\\s+"));
   158         } finally {
   158         } finally {
   159             out = b1.toString();
   159             out = b1.toString();
   160             err = b2.toString();
   160             err = b2.toString();
   161             ex = out;   // now it goes to System.out
   161             ex = out;   // now it goes to System.out
   162             System.setIn(i1);
   162             System.setIn(i1);