Skip to content

Commit

Permalink
Remove unused PK12util class
Browse files Browse the repository at this point in the history
  • Loading branch information
edewata committed Apr 25, 2024
1 parent 3f42e10 commit c4f895c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 58 deletions.
2 changes: 0 additions & 2 deletions base/server/python/pki/server/deployment/__init__.py
Expand Up @@ -102,7 +102,6 @@ def __init__(self):
self.password = None
self.hsm = None
self.certutil = None
self.pk12util = None
self.kra_connector = None
self.systemd = None
self.tps_connector = None
Expand Down Expand Up @@ -191,7 +190,6 @@ def init(self):
self.password = util.Password(self)
self.hsm = util.HSM(self)
self.certutil = util.Certutil(self)
self.pk12util = util.PK12util(self)
self.kra_connector = util.KRAConnector(self)
self.systemd = util.Systemd(self)
self.tps_connector = util.TPSConnector(self)
Expand Down
56 changes: 0 additions & 56 deletions base/server/python/pki/server/deployment/pkihelper.py
Expand Up @@ -1585,62 +1585,6 @@ def import_cert(self, nickname, trust, input_file, password_file,
return


class PK12util:
"""PKI Deployment pk12util class"""

def __init__(self, deployer):
self.mdict = deployer.mdict

def create_file(self, out_file, nickname, out_pwfile,
db_pwfile, path=None, critical_failure=True):

logger.info('Exporting %s cert and key into %s', nickname, out_file)

try:
command = ["pk12util"]
if path:
command.extend(["-d", path])
if out_file:
command.extend(["-o", out_file])
else:
logger.error(log.PKIHELPER_PK12UTIL_MISSING_OUTFILE)
raise Exception(log.PKIHELPER_PK12UTIL_MISSING_OUTFILE)
if nickname:
command.extend(["-n", nickname])
else:
logger.error(log.PKIHELPER_PK12UTIL_MISSING_NICKNAME)
raise Exception(log.PKIHELPER_PK12UTIL_MISSING_NICKNAME)
if out_pwfile:
command.extend(["-w", out_pwfile])
else:
logger.error(log.PKIHELPER_PK12UTIL_MISSING_PWFILE)
raise Exception(log.PKIHELPER_PK12UTIL_MISSING_PWFILE)
if db_pwfile:
command.extend(["-k", db_pwfile])
else:
logger.error(log.PKIHELPER_PK12UTIL_MISSING_DBPWFILE)
raise Exception(log.PKIHELPER_PK12UTIL_MISSING_DBPWFILE)

# encrypt private keys with PKCS#5 PBES2
command.extend(["-c", "AES-128-CBC"])
# don't encrypt public certs
command.extend(["-C", "NONE"])

logger.debug('Command: %s', ' '.join(command))
with open(os.devnull, "w", encoding='utf-8') as fnull:
subprocess.check_call(command, stdout=fnull, stderr=fnull)

except subprocess.CalledProcessError as exc:
logger.error(log.PKI_SUBPROCESS_ERROR_1, exc)
if critical_failure:
raise
except OSError as exc:
logger.error(log.PKI_OSERROR_1, exc)
if critical_failure:
raise
return


class KRAConnector:
"""PKI Deployment KRA Connector Class"""

Expand Down

0 comments on commit c4f895c

Please sign in to comment.