我有代碼找到設備的IMEI號碼,但現在我想加密該格式,我該如何加密?加密IMEI號碼
Q
加密IMEI號碼
0
A
回答
0
在這裏對加密信息Descrypt的樣品使用的字符串密碼
http://www.androidsnippets.com/encryptdecrypt-strings
1
如果你想加密設備本身的號碼,這是不可能的。
如果你想加密您與您的代碼得到的數量,有很多方法可以做到這一點,嘗試尋找在此代碼段:http://www.androidsnippets.com/encryptdecrypt-strings
0
你可以使用的功能,如下列:
private static byte[] encrypt(byte[] raw, byte[] clear) throws Exception {
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] encrypted = cipher.doFinal(clear);
return encrypted;
}
private static byte[] decrypt(byte[] raw, byte[] encrypted) throws Exception {
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, skeySpec);
byte[] decrypted = cipher.doFinal(encrypted);
return decrypted;
}
並調用它們像這樣:
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.PNG, 100, baos); // bm is the bitmap object
byte[] b = baos.toByteArray();
byte[] keyStart = "this is a key".getBytes();
KeyGenerator kgen = KeyGenerator.getInstance("AES");
SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
sr.setSeed(keyStart);
kgen.init(128, sr); // 192 and 256 bits may not be available
SecretKey skey = kgen.generateKey();
byte[] key = skey.getEncoded();
// encrypt
byte[] encryptedData = encrypt(key,b);
// decrypt
byte[] decryptedData = decrypt(key,encryptedData);
相關問題
- 1. 查找IMEI號的代碼
- 2. 需要IMEI號碼爲android
- 3. IMEI號碼使用iphone代碼
- 4. 使用python的手機的IMEI號碼
- 5. 非網絡設備上的IMEI號碼
- 6. 平板電腦的Android imei號碼
- 7. 在wp7中查找IMEI號碼?
- 8. 將IMEI解碼爲序列號
- 9. 如何獲取PhoneGap中的IMEI號碼?
- 10. 加密解密信用卡號碼
- 11. IMEI碼-66解釋?
- 12. IMEI碼/ 01說明
- 13. 如何使用批量IMEI號碼檢查手機型號?
- 14. 如何找到給定IMEI號碼的SIM卡的電話號碼?
- 15. 加密密碼
- 16. 密碼加密
- 17. 加密密碼
- 18. 加密密碼
- 19. 加密密碼
- 20. 加密密碼
- 21. 密碼加密
- 22. 密碼加密
- 23. 密碼加密
- 24. 如何以編程方式從iPhone獲取IMEI號碼?
- 25. 如何在imeiplugin的phonegap應用程序中獲取imei號碼
- 26. 試圖在android中獲取imei號碼 - phonegap
- 27. 如何在Android中獲得雙SIM卡IMEI號碼
- 28. 如何獲得IMEI號碼?我的設備通過離子?
- 29. 獲取Android設備使用php的IMEI號碼
- 30. 在Android中使用電話管理器來查找IMEI號碼
抄襲呢?請給出原始答案的功勞;) – t0mm13b