apple / swift-nio-ssl

TLS Support for SwiftNIO, based on BoringSSL.
https://swiftpackageindex.com/apple/swift-nio-ssl/main/documentation/niossl
Apache License 2.0
383 stars 136 forks source link

Want to enable Pre-Shared Key communication using SSL Service. #230

Closed anil291987 closed 1 year ago

anil291987 commented 4 years ago

Hi, I am connecting with my server with certificate and PSK communication. Able to connect with certificate with server. But not able to figure out how to do PSK communication using swift-nio-ssl. If you have required more information from my side. Please let me know.

Lukasa commented 4 years ago

Yes, we should support this. Pre-Shared Keys are complex enough that we probably want to do this with a delegate protocol for users to implement. The trickiest part of this will be arranging for the PSKs to be able to secure stored on the heap. For that use-case, we probably need to bring over SecureBytes from swift-crypto.

The delegate would be something like:

public protocol NIOSSLPreSharedKeyCache {
    func preSharedKey(identity: [UInt8]) -> SecureBytes
}

Once we have that, wiring up the rest of the interface should be easy enough, I think.

However, this is not a terribly high priority feature for the NIO core team, so we are unlikely to rush to implement this feature. It's on our roadmap, we'll keep this issue open, but if anyone else feels like making the contribution they should go for it.

Lukasa commented 4 years ago

As a breadcrumb, if you're only running your application on Apple platforms, SwiftNIO Transport Services gives you access to Network.framework with SwiftNIO, which already has PSK support.

Lukasa commented 1 year ago

Resolved using #369.