I know that when using Swift on iOS or macOS you can use SecKeyGeneratePair, but the Security library is unavailable on Linux. Short of falling back on Process to use the the OpenSSL CLI interface, is there any way to generate an RSA key pair in Swift.
FYI, I'm using Vapor 3 to build a web API.
So this is many months later, but I thought I would at least update for any others. While I looked into Andrei's suggestion above to use Themis, in the end it really was simplest to simply use Process that I was avoiding originally.
I had to call some local scripts anyway, so I wrote a dead simple Shell class that wrapped Swift's Process. It's not multithreaded, so it's not great for performance. But it works for what I need. I just called OpenSSL's CLI and grabbed the output.
Shell Gist: https://gist.github.com/mattmaddux/9979ec992c2b9744b669bd1728c28c19