buildFromDirectory(dirname(__DIR__).'/src'); $phar->setStub( $phar->createDefaultStub('phar_autoloader.php', 'phar_autoloader.php') ); /** * If we pass an (optional) path to a private key as a second argument, we will * sign the Phar with OpenSSL. * * If you leave this out, it will produce an unsigned .phar! */ if ($argc > 1) { if (!@\is_readable($argv[1])) { echo 'Could not read the private key file:', $argv[1], "\n"; exit(255); } $pkeyFile = \file_get_contents($argv[1]); $private = \openssl_get_privatekey($pkeyFile); if ($private !== false) { $pkey = ''; \openssl_pkey_export($private, $pkey); $phar->setSignatureAlgorithm(\Phar::OPENSSL, $pkey); /** * Save the corresponding public key to the file */ if (!@\is_readable($dist.'/defuse-crypto.phar.pubkey')) { $details = \openssl_pkey_get_details($private); \file_put_contents( $dist.'/defuse-crypto.phar.pubkey', $details['key'] ); } } else { echo 'An error occurred reading the private key from OpenSSL.', "\n"; exit(255); } }