我想在我的自定义存储cordova插件中使用es加密

问题描述 投票:0回答:1

我在我的应用中有AES加密cordova插件,以及自定义的本地存储插件。如何在现有存储插件中使用AES加密插件。

cordova cordova-plugins visual-studio-cordova
1个回答
1
投票

首次安装https://github.com/Ideas2IT/cordova-aes256

那些

ionic cordova plugin add cordova-plugin-aes256-encryption

cordova plugin add cordova-plugin-add-swift-support --save

然后加密您的数据

declare var mycordova: any;


   mySecureKey: String = '12345678910123456789012345678901'; // Any string, the length should be 32
   mySecureIV: String = '1234567891123456'; // Any string, the length should be 16

然后加密,请参阅文档

 let data = "test";
 encrypt(this.mySecureKey, this.mySecureIV, data); 

然后存储它

var storage = window.localStorage;
var value = storage.getItem(key); // Pass a key name to get its value.
storage.setItem(key, your_data) // Pass a key name and its value to add or update 
© www.soinside.com 2019 - 2024. All rights reserved.