I have encrypted file and public key. How can I decrypt it from app without installing certificates?
file public.key looks like "e+ztydr5GG7saZyrIOtSWGQgHlQbuFn1IVlIIggPIWuLUNTOqN0Y..."
Here are some code:
NSString* filePath = [[NSBundle mainBundle] pathForResource:@"public" ofType:@"key"];
NSData* publicKeyData = [NSData dataWithContentsOfFile:filePath];
NSMutableDictionary * queryPublicKey = [[NSMutableDictionary alloc] init];
[queryPublicKey setObject:(id)kSecClassKey forKey:(id)kSecClass];
[queryPublicKey setObject:publicKeyData forKey:(id)kSecAttrApplicationTag];
[queryPublicKey setObject:(id)kSecAttrKeyTypeRSA forKey:(id)kSecAttrKeyType];
[queryPublicKey setObject:[NSNumber numberWithBool:YES] forKey:(id)kSecReturnRef];
OSStatus resultCode = noErr;
SecKeyRef publicKeyReference = NULL;
resultCode = SecItemCopyMatching((CFDictionaryRef)queryPublicKey, (CFTypeRef*)&publicKeyReference);
However resultCode = -25300 (The specified item could not be found in the keychain). What I'm doing wrong? any suggestions?