diff options
Diffstat (limited to 'pki/base/java-tools/src/com/netscape/cmstools/TokenInfo.java')
-rw-r--r-- | pki/base/java-tools/src/com/netscape/cmstools/TokenInfo.java | 63 |
1 files changed, 31 insertions, 32 deletions
diff --git a/pki/base/java-tools/src/com/netscape/cmstools/TokenInfo.java b/pki/base/java-tools/src/com/netscape/cmstools/TokenInfo.java index ade2b467..ee7a3fe3 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/TokenInfo.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/TokenInfo.java @@ -17,59 +17,58 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmstools; - import java.util.Enumeration; import org.mozilla.jss.CryptoManager; import org.mozilla.jss.crypto.CryptoToken; import org.mozilla.jss.pkcs11.PK11Module; - - /** * Tool used to determine which external hardware tokens are visible to the * Certificate System subsystem. This can be used to diagnose whether problems * using tokens are related to the Certificate System being unable to detect it. - * + * * <p> + * * @version $Revision$ Date: $ */ public class TokenInfo { - + /** - * Creates a new instance of CMCRevoke. + * Creates a new instance of CMCRevoke. */ - public static void main(String[]args) { + public static void main(String[] args) { try { - if (args.length != 1) { - System.out.println("Usage: TokenInfo <alias directory>"); - System.exit(0); - } - System.out.println("Database Path: " + args[0]); + if (args.length != 1) { + System.out.println("Usage: TokenInfo <alias directory>"); + System.exit(0); + } + System.out.println("Database Path: " + args[0]); - CryptoManager.InitializationValues vals = - new CryptoManager.InitializationValues(args[0], - "", "", "secmod.db"); + CryptoManager.InitializationValues vals = new CryptoManager.InitializationValues( + args[0], "", "", "secmod.db"); - CryptoManager.initialize(vals); - - CryptoManager cm = CryptoManager.getInstance(); - Enumeration modules = cm.getModules(); - while (modules.hasMoreElements()) { - PK11Module m = (PK11Module)modules.nextElement(); - System.out.println("Found external module '" + m.getName() + "'"); - } - Enumeration tokens = cm.getExternalTokens(); + CryptoManager.initialize(vals); - while (tokens.hasMoreElements()) { - CryptoToken t = (CryptoToken)tokens.nextElement(); - System.out.println("Found external token '" + t.getName() + "'"); - } + CryptoManager cm = CryptoManager.getInstance(); + Enumeration modules = cm.getModules(); + while (modules.hasMoreElements()) { + PK11Module m = (PK11Module) modules.nextElement(); + System.out.println("Found external module '" + m.getName() + + "'"); + } + Enumeration tokens = cm.getExternalTokens(); - }catch (Exception e) { - e.printStackTrace(); - System.exit(1); + while (tokens.hasMoreElements()) { + CryptoToken t = (CryptoToken) tokens.nextElement(); + System.out + .println("Found external token '" + t.getName() + "'"); } - + + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + } } |