🔑 🔐
RSASwiftGenerator
要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install
。
⚠️
要求SWIFT 4
XCode 9+
📲
安装RSASwiftGenerator可以通过CocoaPods获取。要安装它,只需将以下行添加到您的Podfile中
pod 'RSASwiftGenerator'
💻
示例import UIKit
import RSASwiftGenerator
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
kRSASwiftGeneratorApplicationTag = "MY.BUNDLE.ID" //setup your id for keychain saving
kRSASwiftGeneratorKeySize = 2048 //keySize
// generade new key pair
RSASwiftGenerator.shared.createSecureKeyPair() { (succes,error) in
print(succes,error)
}
RSASwiftGenerator.shared.keyPairExists() // check keys for exist
RSASwiftGenerator.shared.getPublicKeyData() // get Data refference as public key
RSASwiftGenerator.shared.getPublicKeyReference() // / get SecKey refference for public key
RSASwiftGenerator.shared.getPrivateKeyReference() // get SecKey refference for private key
RSASwiftGenerator.shared.deleteSecureKeyPair() { (succes) in
print(succes)
}// remove keys from keychain
}
👨💻
作者
许可证
RSASwiftGenerator在MIT许可证下可用。有关更多信息,请参阅LICENSE文件。