1.比如我现在在用net.sqlcipher.database 这个加密库(网上能搜得到的,用于数据库加密)。 那么我现在就在项目用加载这个jar包(在你的项目单击右键-》属性-》Java Build Path-》Libraries-》Add Jars,选择提供给你的jar包,我这里是 sqlcipher.jar,然后在Order and Export勾选你刚刚加载的 jar包。)
2.打开你的workspace目录,在你的项目目录下创建一个文件夹libs(如果文件夹不存在的话),然后将提供给你的so库放入该目录,基本架构就算是搭建好了。
3.进行开发,这里你需要问一下提供给你jar包的厂家,基本的用法,否则的话是无法进行开发的,因为你都不知道怎么去用。 sqlcipher的基本用法是:
SQLiteDatabase.loadLibs(this); //加载 so库文件,你的厂家的方法应该也是类似。
File databaseFile = getDatabasePath(SQLite_toll.DATABASE_NAME);
databaseFile.mkdirs();
databaseFile.delete();
SQLiteDatabase database = SQLiteDatabase.openOrCreateDatabase(databaseFile, helper_SharedPreferences.get_str_sp("database_cipher",this), null);
SQLite_toll initToll = new SQLite_toll(this, avaSys);
initToll.onCreate(database);
database.close();
//因为我sqlcipher是用于数据库加密的,所以你所看到的都是数据库的一些方法,你厂家提供给你的jar包的用法,你是要去问他们的,或者他们的是否有开源代码,又或者是网上也有很多人使用,那么能搜到相关资料。
根据你补充的提问,那么就是System.loadLibrary(this); ,就可以调用了
php 源文件加密工具PHP Screw .
目前最新版本是1.3
网址
我的安装环境
系统:Slackware 10
软件:Apache 1.3.31
PHP 4.3.7
以上环境全部是slackware 10默认安装后自带的。具体的Apache+php+mysql安装方法参照如下
支持php的Apache环境安装
获得软件
下载php_screw-1.3 ()
安装
1.将获得的php_screw-1.3.tgz文件放到/usr/local目录下,然后用tar解压缩
tar zxvf php_screw-1.3.tgz
2.进入/usr/local/php_screw-1.3目录开始安装
cd /usr/local/php_screw-1.3
phpize
./confiugre
3.设置自己用来加密的密码
vi my_screw.h
-- Please change the encryption SEED key (pm9screw_mycryptkey) into the
values according to what you like.
The encryption will be harder to break, if you add more values to the
encryption SEED array. However, the size of the SEED is unrelated to
the time of the decrypt processing.
* If you can read and understand the source code, to modify an original
encryption logic will be possible. But in general, this should not
be necessary.
OPTIONAL: Encrypted scripts get a stamp added to the beginning of the
file. If you like, you may change this stamp defined by
PM9SCREW and PM9SCREW_LEN in php_screw.h. PM9SCREW_LEN must
be less than or equal to the size of PM9SCREW.
4.编译
make
5.拷贝modules目录下的php_screw.so文件到/usr/lib/php/extension目录下
cp modules/php_screw.so /usr/lib/php/extension/
6.编辑php.ini文件
在php.ini文件里,加入如下语句
extension=php_screw.so
7.重新启动Apache
/etc/rc.d/rc.httpd restart
8.编译加密工具
cd tools
make
9.将tools目录下加密用的工具screw拷贝到适当目录
cp screw /usr/bin/
经过以上的10步,就已经把php_screw-1.3全部安装完成了。并且现在的php也已经支持解释加密过的php文件了
使用
1.现写一个要加密的php文件。
我写了如下的一个用来测试php速度的compute.php文件
?
$a=0;
$t=time();
for($i=0;$i5000000;$i++)
{$a=$a*$i;}
$t1=time();
echo "p";
echo "It used:";
echo $t1-$t;
echo "seconds";
?
将上面的compute.php文件放到/var/www/htdocs目录下。通过浏览器访问,将显示出php在大量计算时的速度(只能粗略估计一下)
2.将我们写的php文件加密
cd /var/www/htdocs/
screw compute.php
我们加密后,现在目录下的compute.php文件就是我们已经加密的了。而源文件被改名为compute.php.screw存放了。
我们现在再测试一下compute.php,看看能否正常使用?速度如何?
我比较了一下,加密前后的速度大概一样,基本没有太多的损失。
你可以使用百度搜索的方式,从一些网站上下载对文件/文件夹进行加密的免费软件。但是我劝你最好还是对重要的文件进行一个备份。如果万一将文件加密了,无法进行解密,到了那会儿可就麻烦了。因为加密算法往往是和解密算法配套使用的。
额,一般应用进行个高级混淆基本都可以了,不过也有部分应用对so文件有特殊保护需求,这个一般比较高级了,很多宣称可以做的实际也做不了的,你可以去技术论坛或者网页搜一下,仔细咨询下
现在做应用保护的企业并不多,有3、5家左右,挨个咨询下,总有能满足你需求的。