title: Decrypt file with public key
body: <p>I have encrypted file and public key. How can I decrypt it from app without installing certificates?</p>
  
  <p>file public.key looks like "e+ztydr5GG7saZyrIOtSWGQgHlQbuFn1IVlIIggPIWuLUNTOqN0Y..."</p>
  
  <p>Here are some code:</p>
  
  <pre><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*)&amp;publicKeyReference);
  </code></pre>
  
  <p>However resultCode = -25300 (The specified item could not be found in the keychain). What I'm doing wrong? any suggestions?</p>