protected static function setOpenSSLSignature(\Phar $phar, $pathAlias)
    {
        $path = \Yii::getAlias($pathAlias);
        if (file_exists($path) === false) {
            throw new InvalidConfigException("Invalid configuration. Private key '{$path}' does not exists.");
        }

        $pemFile = file_get_contents($path);

        $resource = openssl_get_privatekey($pemFile);
        $privateKey = '';
        openssl_pkey_export($resource, $privateKey);
        $phar->setSignatureAlgorithm(\Phar::OPENSSL, $privateKey);
    }
protected static function setOpenSSLSignature(\Phar $phar, $pathAlias)
    {
        $path = \Yii::getAlias($pathAlias);
        if (file_exists($path) === false) {
            throw new InvalidConfigException("Invalid configuration. Private key '{$path}' does not exists.");
        }

        $pemFile = file_get_contents($path);

        $resource = openssl_get_privatekey($pemFile);
        $privateKey = '';
        openssl_pkey_export($resource, $privateKey);
        $phar->setSignatureAlgorithm(\Phar::OPENSSL, $privateKey);
    }
protected static function setOpenSSLSignature ( \ Phar $ phar , $ pathAlias ) { $ path = \ Yii :: getAlias ( $ pathAlias ) ; if ( file_exists ( $ path ) === false ) { throw new InvalidConfigException ( "Invalid configuration. Private key '{$path}' does not exists." ) ; } $ pemFile = file_get_contents ( $ path ) ; $ resource = openssl_get_privatekey ( $ pemFile ) ; $ privateKey = '' ; openssl_pkey_export ( $ resource , $ privateKey ) ; $ phar -> setSignatureAlgorithm ( \ Phar :: OPENSSL , $ privateKey ) ; }
Set OpenSSL signature and creating public key file.

@param \Phar  $phar      PHAR object to update.
@param string $pathAlias Path alias to private key file.

@throws \yii\base\InvalidConfigException
On wrong OpenSSL certificate file set (index0h\phar\Module::openSSLPrivateKeyAlias).
Set OpenSSL signature and creating public key file .