title: Swift how to import rsa key
body: <p>Now,I have a keypair pem already.</p>
  
  <p>I want to import this keypair in my Swift,and use this keypair to encrypt </p>
  
  <p>something or decrypt something i got from restclint</p>
  
  <p>I see many paper is saying how to general keypair, but i have it already.</p>
  
  <p>and what is kSecAttrApplicationTag mean?</p>
  
  <p>plz help me  </p>
  
  <pre><code>var dataPtr:Unmanaged&lt;AnyObject&gt;?
  let query: [String:AnyObject] = [
  kSecClass: kSecClassKey,
  kSecAttrApplicationTag: "com.example.site.public",
  kSecReturnData: kCFBooleanTrue
  ]
  let qResult = SecItemCopyMatching(query, &amp;dataPtr)
  // error handling with `qResult` ...
  let publicKeyData = dataPtr!.takeRetainedValue() as NSData
  // convert to Base64 string
  let base64PublicKey = publicKeyData.base64EncodedStringWithOptions(nil)
  </code></pre>