4
存儲在本地存儲或WebSql數據庫中的數據不受保護。 我們可以直接看到WebSql和本地存儲的所有數據,因爲它們以純文本形式存儲。如何在Cordova中保護localstorage和websql數據 - 離子應用
有什麼辦法保護數據?
存儲在本地存儲或WebSql數據庫中的數據不受保護。 我們可以直接看到WebSql和本地存儲的所有數據,因爲它們以純文本形式存儲。如何在Cordova中保護localstorage和websql數據 - 離子應用
有什麼辦法保護數據?
是的,你可以用AES或其他算法加密/解密你的數據。也許你可以嘗試實施https://github.com/digitalbazaar/forge#md5
// generate a random key and IV
// Note: a key size of 16 bytes will use AES-128, 24 => AES-192, 32 => AES-256
var key = forge.random.getBytesSync(16);
var iv = forge.random.getBytesSync(16);
/* alternatively, generate a password-based 16-byte key
var salt = forge.random.getBytesSync(128);
var key = forge.pkcs5.pbkdf2('password', salt, numIterations, 16);
*/
// encrypt some bytes using CBC mode
// (other modes include: CFB, OFB, CTR, and GCM)
var cipher = forge.cipher.createCipher('AES-CBC', key);
cipher.start({iv: iv});
cipher.update(forge.util.createBuffer(someBytes));
cipher.finish();
var encrypted = cipher.output;
// outputs encrypted hex
console.log(encrypted.toHex());
// decrypt some bytes using CBC mode
// (other modes include: CFB, OFB, CTR, and GCM)
var decipher = forge.cipher.createDecipher('AES-CBC', key);
decipher.start({iv: iv});
decipher.update(encrypted);
decipher.finish();
// outputs decrypted hex
console.log(decipher.output.toHex());
我有僞造的教程和加密爲好。 https://blog.nraboy.com/2014/10/implement-aes-strength-encryption-javascript/ –
@Nic Raboy-我們需要存儲密鑰,有些是我們用於加密的。如果有人獲得移動應用程序的密鑰和代碼,那麼它將很容易解密數據,因爲我們在我們的移動應用程序中有加密和解密代碼。對? –
正確,這就是爲什麼你每次想要使用應用程序時都必須讓用戶輸入密鑰。只有密鑰正確才能解密? –