Conceal数据加密包
Conceal 是 Facebook 推出的一个用来对数据进行快速加密和认证的开发包,应用可以使用它来加密数据和大文件存储。Conceal 和其他加密软件不同的是它提供了 Smorgasbord 加密算法和选项,这不是一个一般意义上的数据加密包,只是提供一些有用的方法。
示例代码:
// 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();
评论