Swift RSA Key Loader
Requirements
- iOS 9.0+
Installation
See the subsections below for details about the different installation methods.
Swift Package Manager
- Go to project
File
→Add Packages...
- Search for library, using URL:
https://github.com/dmytriigolovanov/swift-rsa-key-loader
- Set the
Dependency Rule
toUp to Next Major Version
Add Package
Using
- Import library to needed swift file.
import RSAKeyLoader
- Add RSA key file to project (xcodeproj)
- 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.