Skip to content

Commit

Permalink
Tests/EC: add unit test for naked PKCS8 public key
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Mar 5, 2023
1 parent 71b9b64 commit b9996fd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/Unit/Crypt/EC/KeyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use phpseclib3\Crypt\EC\Formats\Keys\PuTTY;
use phpseclib3\Crypt\EC\Formats\Keys\XML;
use phpseclib3\Crypt\EC\PrivateKey;
use phpseclib3\Crypt\EC\PublicKey;
use phpseclib3\Crypt\PublicKeyLoader;
use phpseclib3\Tests\PhpseclibTestCase;

Expand Down Expand Up @@ -670,4 +671,11 @@ public function testEd25519asJWK()

$this->assertTrue($key->verify($plaintext, $sig));
}

public function testNakedPKCS8PubKey()
{
$key = 'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAErPJyxEu2/oKCrJaaTVTrq39DKJ2XcN6W+k8UvGf+Y/lDWNbFitQocabsDUvSN0edHH3UKP5QPTz4cOlyIPMrXQ==';
$key = PublicKeyLoader::load($key);
$this->assertInstanceOf(PublicKey::class, $key);
}
}

0 comments on commit b9996fd

Please sign in to comment.