Ionic Native-AES256:执行解密AES256时发生错误

时间:2018-09-04 08:50:15

标签: typescript ionic-framework encryption aes ionic-native

尝试加密和解密字符串时遇到问题。 我正在使用Ionic的Native插件。 因为加密有效,所以它可能已正确安装。

这是我的代码,大部分都是复制自Ionic docs上的示例的副本:

this._Pass = "1234";
let encryptedData;

this.aes.encrypt('12345678123456781234567812345678', '1234567812345678', this._Pass)
  .then(res => {
    encryptedData =  res;
    console.log('Encrypted Data: ',res)
  })
  .catch((error: any) => console.error(error));

this.aes.decrypt('12345678123456781234567812345678', '1234567812345678', encryptedData)
  .then(res => console.log('Decrypted Data : ',res))
  .catch((error: any) => console.error(error));

这是控制台中的结果:

[app-scripts] [10:35:31]  console.log: Encrypted Data: UFvt/KMgnx5ULVVqBEyueg==
[app-scripts] [10:35:31]  console.error: Error occurred while performing decrypt
[app-scripts] [10:35:32]  console.log: [object Object]

我直接在装有Android 5.0.2的三星平板电脑上运行

0 个答案:

没有答案