title: Validate JWT token with RS256 or RS512 with Swift iOS
body: <p>I am building an iOS application in Swift that needs to be able to validate a JWT token signature with a public key certificate using either RS256 or RS512. </p>
  
  <p>I've been trying to find libraries that support such functionalities but have had issues implementing the ones I have found.</p>
  
  <p>My question is therefore what the recommended way to implement such functionality for a Swift iOS app is?</p>
  
  <p>The ideal scenario is to be able to use one of the recognized frameworks on JWT.io. The only Swift library on JWT.io that supports RS256 or RS512 is the following library:
  <a href="https://github.com/vapor/jwt" rel="nofollow noreferrer">https://github.com/vapor/jwt</a></p>
  
  <p>The functionalities this library supports are ideal, but it however requires implementation through Swift Package Manager, and is built using Vapor. Swift Package manager is currently not supported for iOS, but I've read that there are workarounds to get the swift package manager to work with iOS apps. These are workarounds is willing to take if the Library could function on the the iOS application. However as the library is built for Vapor, my question is if it is even possible to get the library to function on the iOS app I'm building?</p>
  
  <p>If it is not possible use this Library, are there any other libraries that are recommended to use? If not, what is the recommended way to implement this requested functionality? Are there recommended Objective-C libraries that could function on the application?</p>
  
  <p>Thanks in Advance!</p>
  
  <p>Edit:
  By validating I mean that I would like to verify that the signature in the token is correct, meaning that the JWT token has been signed with a private key on the server that the public key cert on the application is corresponding to. Not just decode the Base64Check payload.</p>
  
  <p>Edit 2:
  What I'm trying to achieve is functionality that supports asymmetric keys, meaning that the secret must <strong>not</strong> be stored on both the server and the client application. I'm trying to achieve that the application is only containing non secret information, hence a public key certificate.</p>