Beispiel #1
0
 /**
  * Loads the keys given, optionally excluding keys when a usage is given and they
  * are not configured to be used with the usage given
  *
  * @param array $configuredKeys
  * @param       $usage
  */
 public function loadKeys(array $configuredKeys, $usage)
 {
     foreach ($configuredKeys as $keyData) {
         if (isset($key['X509Certificate'])) {
             $key = new X509($keyData);
         } else {
             $key = new Key($keyData);
         }
         if ($usage && !$key->canBeUsedFor($usage)) {
             continue;
         }
         $this->loadedKeys->add($key);
     }
 }
 /**
  * @param string $usage
  */
 public function __construct($usage)
 {
     $message = sprintf('Invalid key usage given: "%s", usages "%s" allowed', is_string($usage) ? $usage : gettype($usage), implode('", "', Key::getValidKeyUsages()));
     parent::__construct($message);
 }