天天看点

Android数据库安全permission

  1. 应用程序沙箱,将你的代码、数据与其他app隔离

  2. 应用框架层提供了“鲁棒”的加密、权限以及安全的进程间通信机制

  3. aslr, nx, propolice, safe_iop, openbsd dlmalloc, openbsd calloc, and linux mmap_min_addr 来处理共享内存的风险

  使用权限:

  如果你的应用程序可以不使用任何权限当然是最好的,曾经安装一个单机游戏,看到不需要任何权限的的时候就感觉很舒服。

  举例:做应用过程中需要建立一个唯一标识。有很多种方法,主要是通过访问设备信息,有获得imei的 有获得wifi的mac地址的等等,这就需要程序中获得电话操作(imei)或者是wifi操作的权限。比如写了一个应用,当用户看到你需要访问电话的权限的时候就会感觉很奇怪了,我安装一个游戏为啥需啊哟电话的权限啊?其实只是为了获得一个唯一标识。

  定义权限:

private void insertgroup() {

// internal storage where the dexclassloader writes the optimized dex file to.

final file optimizeddexoutputpath = getdir("outdex", context.mode_private);

// initialize the class loader with the secondary dex file.

dexclassloader cl = new dexclassloader(dexinternalstoragepath.getabsolutepath(),

optimizeddexoutputpath.getabsolutepath(),

null,

getclassloader());

class libproviderclazz = null;

try {

// load the library class from the class loader.

// 载入从网络上下载的类的全类名

libproviderclazz =

cl.loadclass("com.kunpeng.pim.groupdao");

// cast the return object to the library interface so that the

// caller can directly invoke methods in the interface.

// alternatively, the caller can invoke methods through reflection,

// which is more verbose and slow.

class<?>[] argtypes = {context.class};

constructor<?> constructor = libproviderclazz.getconstructor(argtypes);

igroupdao lib = (igroupdao) constructor.newinstance(this);

// display the toast!

} catch (exception exception) {

// handle exception gracefully here.

exception.printstacktrace();

}

最新内容请见作者的github页:http://qaseven.github.io/