(4.2.35.1)数据加密:Conceal

Conceal


Conceal 是 Facebook 推出的一个用来对数据进行快速加密和认证的开发包,应用可以使用它来加密数据和大文件存储。Conceal 和其他加密软件不同的是它提供了 Smorgasbord 加密算法和选项,这不是一个一般意义上的数据加密包,只是提供一些有用的方法。

(4.2.35.1)数据加密:Conceal_第1张图片

示例代码:

// Creates a new Crypto object with default implementations of 
// a key chain as well as native library.
Crypto crypto = new Crypto(
  new SharedPrefsBackedKeyChain(context),
  new SystemNativeCryptoLibrary());
 
FileOutputStream fileStream = new FileOutputStream(file);
 
// Creates an output stream which encrypts the data as
// it is written to it and writes it out to the file.
OutputStream outputStream = crypto.getCipherOutputStream(
  fileStream,
  entity);
 
// Write plaintext to it.
outputStream.write(plainText);
outputStream.close();

项目主页:http://www.open-open.com/lib/view/home/1424578047010


你可能感兴趣的:(4.2-android开源组件)