Android设备的加密解密的 [英] Encryption an decryption in android
问题描述
我是新的android.I要加密的文件,我想解密的节目在一个图像视图有人能帮助我。我不知道加密和解密的想法。
I am new in android.I want to encrypt a file and I want to decrypt it an show it in a image view can anyone help me. I have no idea about the encryption and decryption.
推荐答案
如果你有一个<一个href=\"http://stackoverflow.com/questions/3779944/reading-a-specific-file-from-sdcard-in-android\"><$c$c>File$c$c> SD卡的文件,你可以读入一个字节]
,并做 realImageContents =解密(fileContents)
对于一些功能解密()
。然后你可以使用的位图对象=http://developer.android.com/reference/android/graphics/BitmapFactory.html相对=nofollow > BitmapFactory
并传递给<一个href=\"http://developer.android.com/reference/android/widget/ImageView.html#setImageBitmap%28android.graphics.Bitmap%29\"相对=nofollow> ImageView.setImageBitmap()
。
If you have a File
of the file on the SD card, you can read it into a byte[]
, and do realImageContents = decrypt(fileContents)
for some function decrypt()
. Then you can get a Bitmap
object using BitmapFactory
and pass that to ImageView.setImageBitmap()
.
在 javax.crypto中查找实际使用的加密算法。如果你只是想混淆图像,你可以只写你自己的加密(),做
/ 解密()
简单的东西像一个与应用程序中的关键硬codeD XOR加密。
Look at javax.crypto for using actual encryption algorithms. If you just want to obfuscate the image, you could just write your own encrypt()
/decrypt()
that does something simple like an XOR cipher with the key hard-coded in your application.
这篇关于Android设备的加密解密的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!