[AC-5961] Ti.Identity.Keychain read error in Android
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Not Our Bug |
Resolution Date | 2019-01-08T21:40:56.000+0000 |
Affected Version/s | Appcelerator Studio 4.5.0 |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | android, keychain-access |
Reporter | Christian Moss |
Assignee | Shak Hossain |
Created | 2018-10-10T04:57:12.000+0000 |
Updated | 2019-01-09T14:16:38.000+0000 |
Description
The Ti.Identity.Keychain module throws an error when reading a keychain item.
It seems the error is thrown when the text is too long.
Steps to reproduce
{noformat}
var keychainItem = globals.identity.createKeychainItem({
identifier: "myIdentifier"
});
keychainItem.addEventListener('save', function(e) {
if (e.success == 1) {
keychainItem.read();
}
});
keychainItem.addEventListener('read', function(e) {
console.error("keychain read error", e);
});
keychainItem.save("my very long string that isn't really that long but it long enough to cause the issue");
{noformat}
error
{noformat}
no value is returned
{"type":"read","source":{"accessControlMode":0,"accessibilityMode":0,"identifier":"myIdentifier","cipher":"AES/CBC/PKCS7Padding","apiName":"ti.touchid.KeychainItem","bubbleParent":true,"_events":{"save":{},"read":{}}},"identifier":"myIdentifier","error":null,"bubbles":false,"success":false,"code":-1,"cancelBubble":false}
{noformat}
Hello [~cmoss], Thanks for reporting this. Which's your module version? Can you please test this on 7.5.0.GA again and let us know how it goes. It would be helpful if you can share your complete console log, test steps to reproduce this and environment details here.
Hi @Rakhi Mitro yes same on 7.5.0.GA
shows error
if you change the string ti something short it works heres some info of my environment
tested on a android x86emulator 8.1.0
Hello, This is not our issue, this is most likely a native Android keystore issue, this issue is mentioned in this [post| https://stackoverflow.com/questions/27320610/how-can-i-use-the-android-keystore-to-securely-store-arbitrary-strings], Look into the comment by Alamgir Mand. There is nothing we can do about this right now. Thanks.
no problem Actually I ended up making myu own module and learnt more about how keystores differ on iOS on Android on iOS you can store large amounts of data such as json strings etc, however on android it generates keys which are storedi n the keystore and is just meant to store keys that you use to encrypt data which is stored in user preferences. so I assume the error is because im storing something larger than a 32/128 bit key etc however I think the ti identity api/docs doesnt reflect this or make it clear so maybe good to mention it as a cavaet?
Thanks for your feedback.[~cmoss].