From b24ea9e24233636d18806326a9e2883235eb38d7 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Sat, 16 Apr 2016 02:43:03 +0200 Subject: Fixed PKCS #12 export options. The CLIs for exporting PKCS #12 file have been modified to accept options to export without trust flags, keys, and/or certificate chain. https://fedorahosted.org/pki/ticket/1736 --- base/server/python/pki/server/cli/instance.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'base/server/python/pki/server/cli/instance.py') diff --git a/base/server/python/pki/server/cli/instance.py b/base/server/python/pki/server/cli/instance.py index 4eeee5d60..7520b32b8 100644 --- a/base/server/python/pki/server/cli/instance.py +++ b/base/server/python/pki/server/cli/instance.py @@ -77,6 +77,9 @@ class InstanceCertExportCLI(pki.cli.CLI): print(' --pkcs12-password Password for the PKCS #12 file.') print(' --pkcs12-password-file Input file containing the password for the PKCS #12 file.') print(' --append Append into an existing PKCS #12 file.') + print(' --no-trust-flags Do not include trust flags') + print(' --no-key Do not include private key') + print(' --no-chain Do not include certificate chain') print(' -v, --verbose Run in verbose mode.') print(' --debug Run in debug mode.') print(' --help Show help message.') @@ -88,7 +91,8 @@ class InstanceCertExportCLI(pki.cli.CLI): opts, args = getopt.gnu_getopt(argv, 'i:v', [ 'instance=', 'pkcs12-file=', 'pkcs12-password=', 'pkcs12-password-file=', - 'append', 'verbose', 'debug', 'help']) + 'append', 'no-trust-flags', 'no-key', 'no-chain', + 'verbose', 'debug', 'help']) except getopt.GetoptError as e: print('ERROR: ' + str(e)) @@ -102,6 +106,9 @@ class InstanceCertExportCLI(pki.cli.CLI): pkcs12_password = None pkcs12_password_file = None append = False + include_trust_flags = True + include_key = True + include_chain = True debug = False for o, a in opts: @@ -120,6 +127,15 @@ class InstanceCertExportCLI(pki.cli.CLI): elif o == '--append': append = True + elif o == '--no-trust-flags': + include_trust_flags = False + + elif o == '--no-key': + include_key = False + + elif o == '--no-chain': + include_chain = False + elif o in ('-v', '--verbose'): self.set_verbose(True) @@ -154,6 +170,9 @@ class InstanceCertExportCLI(pki.cli.CLI): pkcs12_password_file=pkcs12_password_file, nicknames=nicknames, append=append, + include_trust_flags=include_trust_flags, + include_key=include_key, + include_chain=include_chain, debug=debug) finally: nssdb.close() -- cgit