From b9996fda00fd6e482131880b19e7f71ddc8f2f0e Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sat, 4 Mar 2023 22:14:46 -0600 Subject: [PATCH] Tests/EC: add unit test for naked PKCS8 public key --- tests/Unit/Crypt/EC/KeyTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/Unit/Crypt/EC/KeyTest.php b/tests/Unit/Crypt/EC/KeyTest.php index 0b10bf8d..43928d78 100644 --- a/tests/Unit/Crypt/EC/KeyTest.php +++ b/tests/Unit/Crypt/EC/KeyTest.php @@ -15,6 +15,7 @@ use phpseclib3\Crypt\EC\Formats\Keys\PKCS8; 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; @@ -670,4 +671,11 @@ MIIEDwIBADATBgcqhkjOPQIBBggqhkjOPQMBBwSCA/MwggPvAgEBBIID6P////// $this->assertTrue($key->verify($plaintext, $sig)); } + + public function testNakedPKCS8PubKey() + { + $key = 'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAErPJyxEu2/oKCrJaaTVTrq39DKJ2XcN6W+k8UvGf+Y/lDWNbFitQocabsDUvSN0edHH3UKP5QPTz4cOlyIPMrXQ=='; + $key = PublicKeyLoader::load($key); + $this->assertInstanceOf(PublicKey::class, $key); + } }