Asymmetric: fix for phar's

Inspired by 4e367c9631
This commit is contained in:
terrafrost 2018-02-23 21:15:33 -06:00
parent b9cd84108c
commit 2a6f5f825a

View File

@ -262,8 +262,11 @@ abstract class AsymmetricKey
{ {
if (!isset(self::$plugins[static::ALGORITHM][$format])) { if (!isset(self::$plugins[static::ALGORITHM][$format])) {
self::$plugins[static::ALGORITHM][$format] = []; self::$plugins[static::ALGORITHM][$format] = [];
foreach (glob(__DIR__ . '/../' . static::ALGORITHM . '/' . $format . '/*.php') as $file) { foreach (new \DirectoryIterator(__DIR__ . '/../' . static::ALGORITHM . '/' . $format . '/') as $file) {
$name = pathinfo($file, PATHINFO_FILENAME); if ($file->getExtension() != 'php') {
continue;
}
$name = $file->getBasename('.php');
$type = 'phpseclib\Crypt\\' . static::ALGORITHM . '\\' . $format . '\\' . $name; $type = 'phpseclib\Crypt\\' . static::ALGORITHM . '\\' . $format . '\\' . $name;
self::$plugins[static::ALGORITHM][$format][strtolower($name)] = $type; self::$plugins[static::ALGORITHM][$format][strtolower($name)] = $type;
self::$origPlugins[static::ALGORITHM][$format][] = $name; self::$origPlugins[static::ALGORITHM][$format][] = $name;