Comments (5)
@Krishna25Vrinsoft please share device details.
from cordova-plugin-secure-key-store.
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
#import "SecureKeyStore.h"
#import <Cordova/CDV.h>
@implementation SecureKeyStore
-
(void) set:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = nil;
NSString* key = [command.arguments objectAtIndex:0];
NSString* value = [command.arguments objectAtIndex:1];
@Try {
KeychainWrapper* keychain = [[KeychainWrapper alloc]init];
[keychain mySetObject:value forKey:(__bridge id)(kSecValueData)];
[keychain writeToKeychain];//[[NSUserDefaults standardUserDefaults]setBool:true forKey:key];
[[NSUserDefaults standardUserDefaults] setObject:value forKey:key]; [[NSUserDefaults standardUserDefaults]synchronize]; //NSLog(@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:key]);
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"Key saved to keychain successfully"];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@catch(NSException* exception){
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString: @"Exception: saving key into keychain"];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
} -
(void) get:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = nil;
NSString* key = [command.arguments objectAtIndex:0];
@Try {//NSLog(@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:key]); NSString *value = [[NSUserDefaults standardUserDefaults] objectForKey:key]; pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:value]; [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@catch(NSException* exception){
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString: @"Exception: fetching key from keychain"];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
} -
(void) remove:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = nil;
NSString* key = (NSString*)[command.arguments objectAtIndex:0];
@Try {
[[NSUserDefaults standardUserDefaults] removeObjectForKey:key];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"Key removed successfully"];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@catch(NSException *exception) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString: @"Exception: Could not delete key from keychain"];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
}
=================================================================
Replace SecureKeyStore.m file with above code
from cordova-plugin-secure-key-store.
@pradeep1991singh Is this correct? If it's correct than can you please update plugin?
from cordova-plugin-secure-key-store.
@parthdevmurari91 It seems your solution is not using keychainWrapper
, it just using NSUserDefaults
which is not recommended to use for sensitive data.
from cordova-plugin-secure-key-store.
@Krishna25Vrinsoft
Use latest release v1.5.0
that should fix the issue. And let me know if you still facing same issue.
Thanks.
from cordova-plugin-secure-key-store.
Related Issues (18)
- Error while using cordova.plugins.SecureKeyStore.get for the key that doesn't exist. HOT 1
- Getting "mutating method sent to immutable object" error HOT 5
- 1.5.5 HOT 2
- input must be under 256 bytes HOT 2
- {"code":1,"api-level":23,"message":Error while finalizing cipher} HOT 1
- Error if value is too long HOT 1
- Not working with 1.5.4 HOT 1
- update against deprecations
- javax.crypto.IllegalBlockSizeException
- error object is wrongfully parsed
- how this is related to keystore generated by cordova
- Max entry size HOT 2
- Please publish version 1.5.6 to npm
- E/SecureKeyStore: Exception: Need RSA private or public key HOT 7
- Exception: java.security.NoSuchAlgorithmException HOT 2
- Version 1.4.3 not untar properly HOT 1
- I found one more issue in iOS HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-secure-key-store.