Skip to content

PublicKeyLoader::loadPrivateKey Fails to Load id_ed25519 Keys #2087

@DanielWiedemann248

Description

@DanielWiedemann248

Version: 3.0.44
After the upgrade from version 3.0.43, the PublicKeyLoader can no longer load id_ed25519 Keys. I tested this with freshly generated RSA and id_ed25519 keys:

<?php

include __DIR__ . '/vendor/autoload.php';

$rsaKey = file_get_contents(__DIR__ . '/seclibtestkey');
$ed25519Key = file_get_contents(__DIR__ . '/seclibtestkey_ed25519');

\phpseclib3\Crypt\PublicKeyLoader::loadPrivateKey($rsaKey);

echo "Loading RSA Key works\n";

\phpseclib3\Crypt\PublicKeyLoader::loadPrivateKey($ed25519Key);

echo "Loading ed25519 Key works\n";

Output on 3.0.44:

Loading RSA Key works
PHP Fatal error:  Uncaught phpseclib3\Exception\NoKeyLoadedException: Unable to read key in /home/xxx/Documents/Git/xxx/vendor/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php:64
Stack trace:
#0 /home/xxx/Documents/Git/xxx/vendor/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php(76): phpseclib3\Crypt\PublicKeyLoader::load()
#1 /home/xxx/Documents/Git/xxx/test.php(12): phpseclib3\Crypt\PublicKeyLoader::loadPrivateKey()
#2 {main}
  thrown in /home/xxx/Documents/Git/xxx/vendor/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php on line 64

Same script ran on 3.0.43:

Loading RSA Key works
Loading ed25519 Key works

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions