-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Mailer][Mime] Refactor S/MIME encryption handling in SMimeEncryptionListener
#59831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c3a8318
to
eb8e560
Compare
src/Symfony/Component/Mailer/EventListener/SmimeEncryptedMessageListener.php
Outdated
Show resolved
Hide resolved
204c36f
to
6499c8a
Compare
Replaces direct certificate path usage with a repository interface for managing S/MIME certificates. This improves flexibility by allowing custom certificate retrieval logic through `SmimeCertificateRepositoryInterface`. Adjusted related tests, configuration, and event listener implementation accordingly.
6499c8a
to
7c76c54
Compare
It is important to mention in the documentation that caution should be exercised when sending encrypted emails to multiple recipients. And indeed, all recipients are used here and therefore the main recipients as well as those in BCC. It is therefore possible to know these recipients depending on the encryption method used. |
@@ -2314,8 +2314,8 @@ private function addMailerSection(ArrayNodeDefinition $rootNode, callable $enabl | |||
->canBeEnabled() | |||
->info('S/MIME encrypter configuration') | |||
->children() | |||
->scalarNode('certificate') | |||
->info('Path to certificate (in PEM format without the `file://` prefix)') | |||
->scalarNode('repository') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reviewers, this change is fine as this feature has been introduced in 7.3, so not yet released
SMimeEncryptionListener
SMimeEncryptionListener
SMimeEncryptionListener
Thank you @Spomky. |
It appears that the smime_encrypter introduced in #58501 is incorrect, as the email is encrypted only for the sender instead of being encrypted per recipient.
This PR introduces a new
SmimeCertificateRepositoryInterface
, responsible for retrieving recipient certificates.An email is encrypted under the following conditions:
X-SMime-Encrypt
is present.If either of these conditions is not met, the email is sent unencrypted.
Example of usage: