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-我们需要存储密钥,有些是我们用于加密的。如果有人获得移动应用程序的密钥和代码,那么它将很容易解密数据,因为我们在我们的移动应用程序中有加密和解密代码。对? –
正确,这就是为什么你每次想要使用应用程序时都必须让用户输入密钥。只有密钥正确才能解密? –