Swift RSA Key Loader

Swift RSA Key Loader

Requirements

  • iOS 9.0+

Installation

See the subsections below for details about the different installation methods.

  1. Swift Package Manager

Swift Package Manager

  1. Go to project
  2. FileAdd Packages...
  3. Search for library, using URL:
https://github.com/dmytriigolovanov/swift-rsa-key-loader
  1. Set the Dependency Rule to Up to Next Major Version
  2. Add Package

Using

  1. Import library to needed swift file.
import RSAKeyLoader
  1. Add RSA key file to project (xcodeproj)
  2. Load file with name and file extension (type)

Private Key

let fileName = "rsa_file_name"

do {
  let privateKey = try RSAKeyLoader.loadPrivateKey(fileName: fileName, fileType: .pem)
  // use private key
} catch {
  print(error
}

let fileName = "rsa_file_name"

do {
  let privateKey = try RSAKeyLoader.loadPublicKey(fileName: fileName, fileType: .pem)
  // use public key
} catch {
  print(error
}

Supported file formats

Version PEM
1.0.0 +

License

The contents of this repository are licensed under the
MIT License.

GitHub

View Github