zoukankan      html  css  js  c++  java
  • 使用php-beast扩展给php源码加密

    一、下载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使加密后的文件解密难度加大

  • 相关阅读:
    Django系列6:Model简介,ORM,字段类型,约束
    Django系列4:数据常规操作级联数据
    Django系列5:脑图总结
    Sorted Adjacent Differences
    C
    E. Sleeping Schedule
    D. Ehab the Xorcist
    C. Game with Chips
    D. Walk on Matrixv
    Circle of Monsters
  • 原文地址:https://www.cnblogs.com/jj0219/p/10457513.html
Copyright © 2011-2022 走看看