mirror of
https://github.com/apple/swift-nio-ssl
synced 2026-11-26 04:57:52 +00:00
Motivation: NIOSSL traditionally handles private keys be requiring that they can be decoded into a BoringSSL EVP_PKEY structure. This requires the key to have an in-memory representation that BoringSSL understands, and ultimately forces the bytes of the private key into memory. In many cases, however, this is either undesirable or not possible. For security reasons it is common to want to offload a private key into secure storage, such as the iPhone's Secure Enclave or a portable smart card. In other circumstances it may be useful to put the private key on an entirely different machine and have the signing operations occur over an RPC mechanism. In all of these cases it is necessary to have a programmatic interface to the private key that can be implemented in an essentially arbitrary manner. Modifications: - Defined a new protocol, `NIOSSLCustomPrivateKey`, that allows users to implement the private key operations needed for TLS. - Plumbed support for this interface through `NIOSSLPrivateKey`. - Added support for the BoringSSL interface to `SSLConnection`. Result: Custom TLS private keys backed by function calls can now be provided to NIOSSL.