Ideas2IT / cordova-aes256

MIT License
13 stars 20 forks source link

Method not found in iOS #7

Closed CHUN-WEI-HSU closed 5 years ago

CHUN-WEI-HSU commented 6 years ago

I got an error messages in xCode. it works find in Android

Error: Plugin Optional("AES256") does not respond to method call generateSecureKey:.
Ensure plugin method exists and uses @objc in its declaration
pandiarajan-i2i commented 6 years ago

@gesrt We will check and let you know.

Could you please send us the AES256 plugin and Xcode version details.

CHUN-WEI-HSU commented 6 years ago

Thank you for your assistance. Xcode Version 10.0 (10A255) Plugin Version 1.1.0

sorry for my bad english.

flowli commented 6 years ago

In my case it also works fine on Android but on iOS the decryption always returns NULL. Could this be related?

pandiarajan-i2i commented 6 years ago

Hi @flowli ,

We will look on to this issue. If possible could you please provide us the some additional info,

  1. Have you used the "generateSecureKey" function for creating the secure key?

  2. If you have used own SecureKey then the length should be 32 and for the secure IV length should be 16

flowli commented 6 years ago

I generate the params with this:

import rand from 'csprng';

let params = {
            key: await this.aes.generateSecureKey(rand(256, 16).toString()),
            iv: await this.aes.generateSecureIV(rand(128, 16).toString()),
};

This gets stored securely and is later fed to the encrypt/decrypt methods.

pandiarajan-i2i commented 6 years ago

Thanks @flowli , Could you please send us the generated sample key and iv, AES256 plugin and Xcode version details.

flowli commented 6 years ago

After generating a new key (didn't save the old one) it appears to work. Will let you know when the problem re-appears. Thanks a lot so far!

jhoogeboom commented 5 years ago

I have the same issue as gesrt:

Error: Plugin Optional("AES256") does not respond to method call generateSecureKey:.
Ensure plugin method exists and uses @objc in its declaration

Xcode Version 10.1 (10B61) Plugin Version 1.1.0

installed with capacitor: npm install cordova-plugin-nativestorage