title: Swift Sha512 Encryption ( translate Kotlin code )
body: <p>This is the Kotlin code:</p>
  <pre><code>private fun verify(inputDataToVerify: String, signature: String): Boolean {
      return try {
          val pubKey = &quot;XXXMYPUBKEYXXX&quot;
          val bytesFromPropFile = pubKey.toByteArray()
          val keySpec = X509EncodedKeySpec(Base64.decode(bytesFromPropFile, Base64.DEFAULT))
          val keyFactory = KeyFactory.getInstance(&quot;RSA&quot;)
          val publicKey = keyFactory.generatePublic(keySpec)
          Signature.getInstance(&quot;SHA512WithRSA&quot;).run {
              initVerify(publicKey)
              update(inputDataToVerify.toByteArray())
              verify(Base64.decode(signature.toByteArray(), Base64.DEFAULT))
          }
      } catch (ex: Exception) {
          Timber.e(ex)
          false
      }
  }
  </code></pre>
  <p>I have to convert this piece of code to Swift because I need the same behavior in my iOS app but I'm really new to encryption.
  How can I do? I need third part library?</p>