diff options
author | Abhishek Koneru <akoneru@redhat.com> | 2014-08-25 23:50:33 -0400 |
---|---|---|
committer | Abhishek Koneru <akoneru@redhat.com> | 2014-08-29 11:24:03 -0400 |
commit | a7f8076a5f20812eceac31f7230e4156adf74471 (patch) | |
tree | 1be96a82b903fa6e3ea0c0b066216b90b662c30f /base/java-tools | |
parent | 1c78b740b1d0a12026b978cf4f2c4f714626ac58 (diff) | |
download | pki-a7f8076a5f20812eceac31f7230e4156adf74471.tar.gz pki-a7f8076a5f20812eceac31f7230e4156adf74471.tar.xz pki-a7f8076a5f20812eceac31f7230e4156adf74471.zip |
Fixes for tickets 1087, 1089, 1090, 1091.
Addresses upstream issues in the pki key-* CLI commands.
Updates the man page in all the required cases.
Diffstat (limited to 'base/java-tools')
6 files changed, 25 insertions, 19 deletions
diff --git a/base/java-tools/man/man1/pki-key.1 b/base/java-tools/man/man1/pki-key.1 index 171d21e66..a34a3879f 100644 --- a/base/java-tools/man/man1/pki-key.1 +++ b/base/java-tools/man/man1/pki-key.1 @@ -121,7 +121,7 @@ To view the keys stored in DRM: To view all active keys for a specific client key ID: -.B pki <agent authentication> key-find --client <Client ID> --status active +.B pki <agent authentication> key-find --clientKeyID <Client Key ID> --status active To view details of a specific key: @@ -131,7 +131,7 @@ To view details of a specific key: To archive a passphrase in the DRM: -.B pki <agent authentication> key-archive --clientKeyID <Client ID> --passphrase <Passphrase> +.B pki <agent authentication> key-archive --clientKeyID <Client Key ID> --passphrase <Passphrase> A symmetric key can be archived using the "archiveKey" request template. @@ -274,7 +274,7 @@ All the templates can be listed by executing: To fetch the template for key archival: -.B pki key-template-show archiveKey --output-file <File_Path_to_store_the_template> +.B pki key-template-show archiveKey --output <output file> This command gets the template for a key archival request and stores it in an output file. @@ -298,7 +298,7 @@ To create an archival request using the template file: To fetch the template for key retrieval: -.B pki key-template-show retrieveKey --output-file <File_Path_to_store_the_template> +.B pki key-template-show retrieveKey --output <output file> This command gets the template for a key retrieval request and stores it in an output file. @@ -319,8 +319,8 @@ To create a retrieval request using the template file: .SS Creating a symmetric key generation request To fetch the template for symmetric key generation: -:q!: -.B pki key-template-show generateKey --output-file <File_Path_to_store_the_template> + +.B pki key-template-show generateKey --output <output file> This command gets the template for a symmetric key generation request and stores it in an output file. diff --git a/base/java-tools/src/com/netscape/cmstools/key/KeyCLI.java b/base/java-tools/src/com/netscape/cmstools/key/KeyCLI.java index 82235d278..c6bb6933d 100644 --- a/base/java-tools/src/com/netscape/cmstools/key/KeyCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/key/KeyCLI.java @@ -88,7 +88,7 @@ public class KeyCLI extends CLI { public static void printKeyInfo(KeyInfo info) { System.out.println(" Key ID: "+info.getKeyId().toHexString()); - if (info.getClientKeyID() != null) System.out.println(" Client ID: "+info.getClientKeyID()); + if (info.getClientKeyID() != null) System.out.println(" Client Key ID: "+info.getClientKeyID()); if (info.getStatus() != null) System.out.println(" Status: "+info.getStatus()); if (info.getAlgorithm() != null) System.out.println(" Algorithm: "+info.getAlgorithm()); if (info.getSize() != null) System.out.println(" Size: "+info.getSize()); diff --git a/base/java-tools/src/com/netscape/cmstools/key/KeyFindCLI.java b/base/java-tools/src/com/netscape/cmstools/key/KeyFindCLI.java index 73bad6b58..8ec7db4d9 100644 --- a/base/java-tools/src/com/netscape/cmstools/key/KeyFindCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/key/KeyFindCLI.java @@ -49,8 +49,8 @@ public class KeyFindCLI extends CLI { } public void createOptions() { - Option option = new Option(null, "client", true, "Client ID"); - option.setArgName("client ID"); + Option option = new Option(null, "clientKeyID", true, "Unique client key identifier"); + option.setArgName("client key ID"); options.addOption(option); option = new Option(null, "status", true, "Status"); @@ -101,7 +101,7 @@ public class KeyFindCLI extends CLI { System.exit(-1); } - String clientKeyID = cmd.getOptionValue("client"); + String clientKeyID = cmd.getOptionValue("clientKeyID"); String status = cmd.getOptionValue("status"); String s = cmd.getOptionValue("maxResults"); diff --git a/base/java-tools/src/com/netscape/cmstools/key/KeyRecoverCLI.java b/base/java-tools/src/com/netscape/cmstools/key/KeyRecoverCLI.java index 5077330fa..b23577f53 100644 --- a/base/java-tools/src/com/netscape/cmstools/key/KeyRecoverCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/key/KeyRecoverCLI.java @@ -38,7 +38,7 @@ public class KeyRecoverCLI extends CLI { option.setArgName("Key Identifier"); options.addOption(option); - option = new Option(null, "input", true, "Location of the request template file."); + option = new Option(null, "input", true, "Location of the request file."); option.setArgName("Input file path"); options.addOption(option); } @@ -71,6 +71,7 @@ public class KeyRecoverCLI extends CLI { } String requestFile = cmd.getOptionValue("input"); + String keyID = cmd.getOptionValue("keyID"); KeyRequestResponse response = null; @@ -96,9 +97,13 @@ public class KeyRecoverCLI extends CLI { System.exit(-1); } - } else { + } else if (keyID != null) { String keyId = cmd.getOptionValue("keyID"); response = keyCLI.keyClient.recoverKey(new KeyId(keyId), null, null, null, null); + } else { + System.err.println("Error: Neither a key ID nor a request file's path is specified."); + printHelp(); + System.exit(-1); } MainCLI.printMessage("Key Recovery Request Information"); diff --git a/base/java-tools/src/com/netscape/cmstools/key/KeyTemplateFindCLI.java b/base/java-tools/src/com/netscape/cmstools/key/KeyTemplateFindCLI.java index 0e76d4f1d..3303560a6 100644 --- a/base/java-tools/src/com/netscape/cmstools/key/KeyTemplateFindCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/key/KeyTemplateFindCLI.java @@ -65,11 +65,12 @@ public class KeyTemplateFindCLI extends CLI { e.printStackTrace(); System.exit(-1); } - MainCLI.printMessage("List of templates"); + MainCLI.printMessage(templates.size() + " entries matched"); for (KeyTemplate template : templates) { template.printTemplateInfo(); } System.out.println(); + MainCLI.printMessage("Number of entries returned " + templates.size()); } public void createTemplateList() throws FileNotFoundException, JAXBException { diff --git a/base/java-tools/src/com/netscape/cmstools/key/KeyTemplateShowCLI.java b/base/java-tools/src/com/netscape/cmstools/key/KeyTemplateShowCLI.java index 77d0680b4..30a40390a 100644 --- a/base/java-tools/src/com/netscape/cmstools/key/KeyTemplateShowCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/key/KeyTemplateShowCLI.java @@ -31,8 +31,8 @@ public class KeyTemplateShowCLI extends CLI { } public void createOptions() { - Option option = new Option(null, "output-file", true, "Location where the template has to be stored."); - option.setArgName("File to write the template to."); + Option option = new Option(null, "output", true, "Location to store the template."); + option.setArgName("output file"); options.addOption(option); } @@ -63,7 +63,7 @@ public class KeyTemplateShowCLI extends CLI { } String templateId = cmdArgs[0]; - String writeToFile = cmd.getOptionValue("output-file"); + String writeToFile = cmd.getOptionValue("output"); String templateDir = "/usr/share/pki/key/templates/"; String templatePath = templateDir + templateId + ".xml"; ResourceMessage data = null; @@ -71,10 +71,10 @@ public class KeyTemplateShowCLI extends CLI { data = ResourceMessage.unmarshall(KeyArchivalRequest.class, templatePath); } catch (FileNotFoundException | JAXBException e2) { System.err.println("Error: " + e2.getMessage()); - if(verbose) - e2.printStackTrace(); + if (verbose) + e2.printStackTrace(); System.exit(-1); - }; + } if (writeToFile != null) { try (FileOutputStream fOS = new FileOutputStream(writeToFile)) { |