From c852426bd4c2dcce88c581735863603ed4c9b556 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 7 Oct 2015 19:54:08 +0200 Subject: [PATCH] Enigma: Display all usage flags of the subkey --- plugins/enigma/lib/enigma_driver_gnupg.php | 10 +--------- plugins/enigma/lib/enigma_key.php | 8 ++++---- plugins/enigma/lib/enigma_ui.php | 8 ++++---- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/plugins/enigma/lib/enigma_driver_gnupg.php b/plugins/enigma/lib/enigma_driver_gnupg.php index c41c6c192..5ddf724be 100644 --- a/plugins/enigma/lib/enigma_driver_gnupg.php +++ b/plugins/enigma/lib/enigma_driver_gnupg.php @@ -423,14 +423,6 @@ class enigma_driver_gnupg extends enigma_driver $ekey->name = trim($ekey->users[0]->name . ' <' . $ekey->users[0]->email . '>'); foreach ($key->getSubKeys() as $idx => $subkey) { - $usage = 0; - if ($subkey->canSign()) { - $usage += enigma_key::CAN_SIGN; - } - if ($subkey->canEncrypt()) { - $usage += enigma_key::CAN_ENCRYPT; - } - $skey = new enigma_subkey(); $skey->id = $subkey->getId(); $skey->revoked = $subkey->isRevoked(); @@ -440,7 +432,7 @@ class enigma_driver_gnupg extends enigma_driver $skey->has_private = $subkey->hasPrivate(); $skey->algorithm = $subkey->getAlgorithm(); $skey->length = $subkey->getLength(); - $skey->usage = $usage; + $skey->usage = $subkey->usage(); $ekey->subkeys[$idx] = $skey; }; diff --git a/plugins/enigma/lib/enigma_key.php b/plugins/enigma/lib/enigma_key.php index b687e626c..976cb457d 100644 --- a/plugins/enigma/lib/enigma_key.php +++ b/plugins/enigma/lib/enigma_key.php @@ -26,10 +26,10 @@ class enigma_key const TYPE_KEYPAIR = 1; const TYPE_PUBLIC = 2; - const CAN_SIGN = 1; - const CAN_ENCRYPT = 2; - const CAN_CERTIFY = 4; - const CAN_AUTH = 8; + const CAN_ENCRYPT = 1; + const CAN_SIGN = 2; + const CAN_CERTIFY = 4; + const CAN_AUTHENTICATE = 8; /** diff --git a/plugins/enigma/lib/enigma_ui.php b/plugins/enigma/lib/enigma_ui.php index e596fdea9..132b49b31 100644 --- a/plugins/enigma/lib/enigma_ui.php +++ b/plugins/enigma/lib/enigma_ui.php @@ -398,10 +398,10 @@ class enigma_ui $now = time(); $date_format = $this->rc->config->get('date_format', 'Y-m-d'); $usage_map = array( - enigma_key::CAN_ENCRYPT => $this->enigma->gettext('typeencrypt'), - enigma_key::CAN_SIGN => $this->enigma->gettext('typesign'), - enigma_key::CAN_CERTIFY => $this->enigma->gettext('typecert'), - enigma_key::CAN_AUTH => $this->enigma->gettext('typeauth'), + enigma_key::CAN_ENCRYPT => $this->enigma->gettext('typeencrypt'), + enigma_key::CAN_SIGN => $this->enigma->gettext('typesign'), + enigma_key::CAN_CERTIFY => $this->enigma->gettext('typecert'), + enigma_key::CAN_AUTHENTICATE => $this->enigma->gettext('typeauth'), ); foreach ($this->data->subkeys as $subkey) {