【发布时间】:2019-01-03 21:10:28
【问题描述】:
我知道在 iOS 或 macOS 上使用 Swift 时,您可以使用 SecKeyGeneratePair,但安全库在 Linux 上不可用。没有依靠 Process 来使用 OpenSSL CLI 接口,有没有办法在 Swift 中生成 RSA 密钥对。
仅供参考,我正在使用 Vapor 3 构建 Web API。
【问题讨论】:
-
一种选择是查看使用 search string 'openssl language:swift' 找到的 GitHub Swift 存储库。搜索返回几个示例,这些示例以编程方式在 Linux 上使用来自 Swift 的 OpenSSL C 库头文件。
-
我差点投反对票,并在Generate an RSA public / private key pair 上关闭。但我发现我错了。 +1 用于提出原始问题。