Aleksander Machniak
2016-02-05 bd0551b22076b82a6d49e9f7a2b2e0c90a1b2326
plugins/enigma/lib/enigma_key.php
@@ -1,5 +1,6 @@
<?php
/*
/**
 +-------------------------------------------------------------------------+
 | Key class for the Enigma Plugin                                         |
 |                                                                         |
@@ -25,8 +26,11 @@
    const TYPE_KEYPAIR = 1;
    const TYPE_PUBLIC  = 2;
    const CAN_SIGN    = 1;
    const CAN_ENCRYPT = 2;
    const CAN_ENCRYPT      = 1;
    const CAN_SIGN         = 2;
    const CAN_CERTIFY      = 4;
    const CAN_AUTHENTICATE = 8;
    /**
     * Keys list sorting callback for usort()
@@ -98,9 +102,7 @@
            if ($user->email === $email && $user->valid && !$user->revoked) {
                foreach ($this->subkeys as $subkey) {
                    if (!$subkey->revoked && (!$subkey->expires || $subkey->expires > $now)) {
                        if (($mode == self::CAN_ENCRYPT && $subkey->can_encrypt)
                            || ($mode == self::CAN_SIGN && $subkey->has_private)
                        ) {
                        if ($subkey->usage & $mode) {
                            return $subkey;
                        }
                    }
@@ -146,5 +148,4 @@
        return $result;
    }
}