From ef6e64994ac4d98dc6748ff2c960d19acaa721b4 Mon Sep 17 00:00:00 2001 From: Paragon Initiative Enterprises Date: Wed, 8 May 2024 12:06:38 -0400 Subject: [PATCH] Put an end to newline issues --- src/Composer.php | 2 +- test/CustomCASupportTest.php | 3 ++- test/CustomValidator.php | 4 ++-- test/RemoteFetchTest.php | 2 ++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Composer.php b/src/Composer.php index 23f70a6..979a5fa 100644 --- a/src/Composer.php +++ b/src/Composer.php @@ -41,7 +41,7 @@ public static function postAutoloadDump(Event $event) * @param string $dataDir * @return void */ - protected static function dos2unixAll($dataDir) + public static function dos2unixAll($dataDir) { foreach (glob($dataDir . '/*.pem') as $pemFile) { $contents = file_get_contents($pemFile); diff --git a/test/CustomCASupportTest.php b/test/CustomCASupportTest.php index 6e8faa7..ba2f888 100644 --- a/test/CustomCASupportTest.php +++ b/test/CustomCASupportTest.php @@ -1,6 +1,7 @@ markTestSkipped('not important for now'); $keypair = \ParagonIE_Sodium_Compat::crypto_sign_keypair(); $secretKey = \ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); $publicKey = \ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); @@ -71,6 +71,7 @@ public function testCustom() \hash_file('sha256', __DIR__ . '/static/combined.pem'), $customLatest->getSha256Sum() ); + $this->assertTrue(file_exists($customLatest->getFilePath()), 'File does not exist'); $this->assertTrue($validator->checkEd25519Signature($customLatest)); } diff --git a/test/CustomValidator.php b/test/CustomValidator.php index ac65559..14dd42b 100644 --- a/test/CustomValidator.php +++ b/test/CustomValidator.php @@ -36,9 +36,9 @@ public static function setPublicKey($string) */ public function checkEd25519Signature(Bundle $bundle, $backupKey = false) { - return \ParagonIE_Sodium_File::verify( + return \sodium_crypto_sign_verify_detached( $bundle->getSignature(true), - $bundle->getFilePath(), + $bundle->getFileContents(), Hex::decode(self::$publicKey) ); } diff --git a/test/RemoteFetchTest.php b/test/RemoteFetchTest.php index fd0fe2b..a16eb0a 100644 --- a/test/RemoteFetchTest.php +++ b/test/RemoteFetchTest.php @@ -1,6 +1,7 @@ assertFalse(\file_exists($this->dir . '/ca-certs.json')); $fetch = new RemoteFetch($this->dir); + Composer::dos2unixAll($this->dir); $fetch->getLatestBundle(); $this->assertTrue(\file_exists($this->dir . '/ca-certs.json'));