Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions features/make-phar.feature
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,14 @@ Feature: Check `utils/make-phar.php` output
Error: Couldn't find plugin-status.mustache
"""
And the return code should be 0

Scenario: Phar is signed with SHA-512
Given an empty directory
And a new Phar with the same version

When I run `cp {PHAR_PATH} signed.phar`
And I run `php -r 'echo (new Phar( "signed.phar" ))->getSignature()["hash_type"];'`
Comment thread
swissspidy marked this conversation as resolved.
Then STDOUT should be:
"""
SHA-512
"""
4 changes: 4 additions & 0 deletions utils/make-phar.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ function get_composer_versions( $current_version ) {
EOB
);

// PHP verifies the signature over the whole archive on every invocation, and
// SHA-512 is noticeably faster to compute than the SHA-256 default on 64-bit CPUs.
$phar->setSignatureAlgorithm( Phar::SHA512 );

$phar->stopBuffering();

chmod( DEST_PATH, 0755 ); // Make executable.
Expand Down
Loading