summaryrefslogtreecommitdiffstats
path: root/base/java-tools/src/com/netscape/cmstools/pkcs12/PKCS12ExportCLI.java
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2016-04-15 02:30:00 +0200
committerEndi S. Dewata <edewata@redhat.com>2016-04-15 20:03:36 +0200
commitd3bbfe07b1cb2d65a7af6530ea01374b20a761e4 (patch)
tree1fd572a9a76b5bfc4610037b1c45ef5d8a63e4f4 /base/java-tools/src/com/netscape/cmstools/pkcs12/PKCS12ExportCLI.java
parent08f032de4090467ac4096f970609e19834b997ac (diff)
downloadpki-d3bbfe07b1cb2d65a7af6530ea01374b20a761e4.tar.gz
pki-d3bbfe07b1cb2d65a7af6530ea01374b20a761e4.tar.xz
pki-d3bbfe07b1cb2d65a7af6530ea01374b20a761e4.zip
Updated pki pkcs12-export CLI.
For consistency the pki pkcs12-export has been modified to overwrite the PKCS #12 output file by default. A new option has been added to append the exported certificates and keys into the output file if the file already exists. The same option has been added to the The pki-server instance-cert-export and subsystem-cert-export commands. https://fedorahosted.org/pki/ticket/1736
Diffstat (limited to 'base/java-tools/src/com/netscape/cmstools/pkcs12/PKCS12ExportCLI.java')
-rw-r--r--base/java-tools/src/com/netscape/cmstools/pkcs12/PKCS12ExportCLI.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/base/java-tools/src/com/netscape/cmstools/pkcs12/PKCS12ExportCLI.java b/base/java-tools/src/com/netscape/cmstools/pkcs12/PKCS12ExportCLI.java
index fab5ecdda..728a9efd1 100644
--- a/base/java-tools/src/com/netscape/cmstools/pkcs12/PKCS12ExportCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/pkcs12/PKCS12ExportCLI.java
@@ -61,7 +61,7 @@ public class PKCS12ExportCLI extends CLI {
option.setArgName("path");
options.addOption(option);
- options.addOption(null, "new-file", false, "Create a new PKCS #12 file");
+ options.addOption(null, "append", false, "Append into an existing PKCS #12 file");
options.addOption(null, "no-trust-flags", false, "Do not include trust flags");
options.addOption(null, "no-key", false, "Do not include private key");
options.addOption(null, "no-chain", false, "Do not include certificate chain");
@@ -128,7 +128,7 @@ public class PKCS12ExportCLI extends CLI {
Password password = new Password(passwordString.toCharArray());
- boolean newFile = cmd.hasOption("new-file");
+ boolean append = cmd.hasOption("append");
boolean includeTrustFlags = !cmd.hasOption("no-trust-flags");
boolean includeKey = !cmd.hasOption("no-key");
boolean includeChain = !cmd.hasOption("no-chain");
@@ -139,13 +139,13 @@ public class PKCS12ExportCLI extends CLI {
PKCS12 pkcs12;
- if (newFile || !new File(filename).exists()) {
- // if new file requested or file does not exist, create a new file
- pkcs12 = new PKCS12();
+ if (append && new File(filename).exists()) {
+ // if append requested and file exists, export into the existing file
+ pkcs12 = util.loadFromFile(filename, password);
} else {
- // otherwise, export into the existing file
- pkcs12 = util.loadFromFile(filename, password);
+ // otherwise, create a new file
+ pkcs12 = new PKCS12();
}
if (nicknames.length == 0) {