Deprecate NIOSSLCertificate(file:format:)#550
Merged
glbrntt merged 2 commits intoapple:mainfrom Jul 15, 2025
Merged
Conversation
Motivation: NIOSSLCertificate has an 'init' which loads a single cert from PEM or DER encoded file. This, obviously, only loads the first PEM which is very rarely what users actually want to do. This is a common source of error when loading cert chains and is easy to miss in review. Modifications: - Deprecate the init and point users to the `fromPEMBytes` method for PEM which returns an array of certs, and to a new `fromDERBytes` which returns a single cert. Result: Harder to misuse API
gjcairo
approved these changes
Jul 15, 2025
glbrntt
added a commit
to glbrntt/swift-nio-ssl
that referenced
this pull request
Jul 15, 2025
Motivation: In apple#550 a use of `NIOSSLCertificafe(file:format:)` was replaced with `NIOSSLCertificafe.loadPEMFile(_:).first`, which isn't necessarily the same (the error flow is different for one). To avoid any subtle behaioral changes revert back to the old API in that one instance. Modifications: - Use old API Result: Fewer behavioural changes
glbrntt
added a commit
that referenced
this pull request
Jul 15, 2025
Motivation: In #550 a use of `NIOSSLCertificafe(file:format:)` was replaced with `NIOSSLCertificafe.loadPEMFile(_:).first`, which isn't necessarily the same (the error flow is different for one). To avoid any subtle behaioral changes revert back to the old API in that one instance. Modifications: - Use old API Result: Fewer behavioural changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
NIOSSLCertificate has an 'init' which loads a single cert from PEM or
DER encoded file. This, obviously, only loads the first PEM which is
very rarely what users actually want to do. This is a common source of
error when loading cert chains and is easy to miss in review.
Modifications:
fromPEMBytesmethod forPEM which returns an array of certs, and to a new
fromDERByteswhichreturns a single cert.
Result:
Harder to misuse API