public static function addSignature(\Phar $phar, $signature, $privateKeyAlias = null)
    {
        if ($signature === false) {
            return;
        }
        echo "\nAdd signature";
        if (in_array($signature, [\Phar::MD5, \Phar::SHA1, \Phar::SHA256, \Phar::SHA512], true) === true) {
            $phar->setSignatureAlgorithm($signature);
        } elseif ($signature === \Phar::OPENSSL) {
            self::setOpenSSLSignature($phar, $privateKeyAlias);
        } else {
            throw new InvalidConfigException("Invalid configuration. Unknown signature type '{$signature}'.");
        }
    }