Skip to content

Commit

Permalink
Put an end to newline issues
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed May 8, 2024
1 parent 42c814e commit ef6e649
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion test/CustomCASupportTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace ParagonIE\Certainty\Tests;

use ParagonIE\Certainty\Composer;
use ParagonIE\Certainty\Exception\CertaintyException;
use ParagonIE\Certainty\Exception\CryptoException;
use ParagonIE\ConstantTime\Hex;
Expand Down Expand Up @@ -49,7 +50,6 @@ public function after()
*/
public function testCustom()
{
$this->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);
Expand All @@ -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));
}
Expand Down
4 changes: 2 additions & 2 deletions test/CustomValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
Expand Down
2 changes: 2 additions & 0 deletions test/RemoteFetchTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace ParagonIE\Certainty\Tests;

use ParagonIE\Certainty\Composer;
use ParagonIE\Certainty\Exception\CertaintyException;
use ParagonIE\Certainty\RemoteFetch;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -59,6 +60,7 @@ public function testRemoteFetch()
}
$this->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'));

Expand Down

0 comments on commit ef6e649

Please sign in to comment.