diff --git a/wscli-php-sdk/src/WsCli.php b/wscli-php-sdk/src/WsCli.php index 54f87e9..8db9b7c 100644 --- a/wscli-php-sdk/src/WsCli.php +++ b/wscli-php-sdk/src/WsCli.php @@ -365,12 +365,20 @@ private function handleCerts($api, $cmd) $this->log->debug(print_r($resp, true)); return $resp; case "importCert": - $error = $this->checkArgs(['apikey', 'idtoken', 'certpemdata']); + $error = $this->checkArgs(['apikey', 'idtoken', 'bank', 'certificate', 'privatekey']); + if ($this->opts['bank'] === "danskebank") { + $error = $this->checkArgs(['apikey', 'idtoken', 'bank', 'certificate', 'privatekey', 'enccertificate', 'encprivatekey']); + } if ($error) { return $error; } - $this->log->error("Unimplemented API command"); - return 3; + $resp = $this->${"api"}->${"cmd"}( + $this->opts['idtoken'], + $this->getBodyParams(), + $this->opts['bank'] + ); + $this->log->debug(print_r($resp, true)); + return $resp; case "exportCert": $error = $this->checkArgs(['apikey', 'idtoken', 'pgpkeyid', 'outfilename']); if ($error) { @@ -555,7 +563,6 @@ private function getOptsFromConfig() $config_args = yaml_parse(file_get_contents($this->config_filename)); if ($config_args === false) { $this->log->error("Config file YAML parse error; " . $this->config_filename); - return -1; } if ($config_args['settings']) { @@ -568,6 +575,8 @@ private function getOptsFromConfig() $this->log->info("Removing old token from config"); $this->updateConfig("idtoken: \"\""); $this->updateConfig("idtokenexpiry: \"\""); + $config_args['settings']['idtoken'] = ""; + $config_args['settings']['idtokenexpiry'] = ""; } if (strlen($config_args['settings']['idtoken']) <= 0) { $this->log->debug("Removing idtoken from settings; " . $config_args['settings']['idtoken']); diff --git a/wscli-php/src/wscli.php b/wscli-php/src/wscli.php index 0eecd84..a826154 100755 --- a/wscli-php/src/wscli.php +++ b/wscli-php/src/wscli.php @@ -43,13 +43,13 @@ wscli files deleteFile [-c CONF] [-a APIKEY] [-i IDTOKEN] [-b BANK] [--filetype=] [--filereference=] wscli files uploadFile [-c CONF] [-a APIKEY] [-i IDTOKEN] [-b BANK] [--filetype=] [--filename=] [--filecontents=] - wscli certs listCerts [-c CONF] [-a APIKEY] [-i IDTOKEN] [-b BANK] - wscli certs importCert [-c CONF] [-a APIKEY] [-i IDTOKEN] [--certificate=] [--privatekey=] [--enccertificate=] [--encprivatekey=] + wscli certs listCerts [-c CONF] [-a APIKEY] [-i IDTOKEN] wscli certs exportCert [-c CONF] [-a APIKEY] [-i IDTOKEN] [-b BANK] [--pgpkeyid=] [--outfilename=] wscli certs shareCerts [-c CONF] [-a APIKEY] [-i IDTOKEN] [--extemail=] wscli certs unshareCerts [-c CONF] [-a APIKEY] [-i IDTOKEN] [--extemail=] - wscli certs enrollCert [-c CONF] [-a APIKEY] [-i IDTOKEN] [-b BANK] [--pincode=] [--company=] - [--wsuserid=] [--wstargetid=] + wscli certs enrollCert [-c CONF] [-a APIKEY] [-i IDTOKEN] [-b BANK] [--pincode=] [--company=] [--wsuserid=] [--wstargetid=] + wscli certs importCert [-c CONF] [-a APIKEY] [-i IDTOKEN] [-b BANK] [--certificate=] [--privatekey=] + [--wsuserid=] [--wstargetid=] [--enccertificate=] [--encprivatekey=] wscli pgp listKeys [-c CONF] [-a APIKEY] [-i IDTOKEN] wscli pgp uploadKey [-c CONF] [-a APIKEY] [-i IDTOKEN] [--pgpkeycontents=] wscli pgp deleteKey [-c CONF] [-a APIKEY] [-i IDTOKEN] [--pgpkeyid=] @@ -81,7 +81,6 @@ --wsuserid= Use wsuserid in certificate enrollment --pgpkeyid= PGP/GPG Key Id --outfilename= Output filename for exported cert in PEM format - --certpemdata= Import cert data in PEM format --pgpkeycontents= PGP key contents for PGP key upload --certificate= Imported certificate in PEM format --privatekey= Imported private key in PEM format, must match with certificate