使用php-beast扩展给php源码加密

时间:2019-03-01 17:56:34   收藏:0   阅读:690

一、下载php-beast 登录ssh
wget https://github.com/liexusong/php-beast/archive/master.zip

技术分享图片

 

解压:unzip master.zip

技术分享图片

 

进入解压目录:cd php-beast-master

 

查找php目录下phpize文件并执行它。
执行phpize安装扩展模块 : /www/server/php/71/bin/phpize

技术分享图片

 

找到php-config文件并配置,--enable-beast-debug若无需解密文件则不配置

加载配置 ./configure  --with-php-config=/www/server/php/71/bin/php-config --enable-beast-debug

技术分享图片

 

编译:sudo make && make install

技术分享图片

 记住编译后文件夹位置在下面找beast.so文件。

 技术分享图片

技术分享图片

添加扩展,在php.ini中加入:extension= /www/server/php/71/lib/php/extensions/no-debug-non-zts-20160303/beast.so

最后重载配置。

使用beast_encode_file()函数加密文件
beast_encode_file(string $input_file, string $output_file, int expire_timestamp, int encrypt_type)

1. $input_file: 要加密的文件
2. $output_file: 输出的加密文件路径
3. $expire_timestamp: 文件过期时间戳
4. $encrypt_type: 加密使用的算法(支持:BEAST_ENCRYPT_TYPE_DES、BEAST_ENCRYPT_TYPE_AES)

 

另外你还可以对扩展进行简单配置,让你的加密更加安全。配置项如下:

 修改该签名隐藏加密方式

技术分享图片

 

 加上网卡号,使加密后的PHP代码只能在该网卡下的服务器运行

技术分享图片

 

 

 修改加密key使加密后的文件解密难度加大

技术分享图片

技术分享图片

 

原文:https://www.cnblogs.com/jj0219/p/10457513.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!