-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
add s/mime encryption #127
Comments
Yep, that would be nice. The difficulty in PHPMailer is in doing it at the right point since header and body generation is messy, and it would need to interact with S/MIME and DKIM signing too. Good example of sign and encrypt here. |
yes. Have you considered splitting out some functionality from class.phpmailer.php into smaller subclasses? It might help reduce the complexity if something like a decorator pattern http://en.wikipedia.org/wiki/Decorator_pattern was used to do the encryption. So you might have a class Message {
public function createHeader()
public function createBody()
public function preSend()
public function postSend()
... etc
} and then decorate it with class DKIMMessage extends Message {
private $parent;
public function __construct(Message $parent) { $this->parent = $parent; }
public function preSend() { $this->parent->preSend(); $this->dkimSign(); }
... etc
}
class SMIMESignedMessage extends Message {}
class SMIMEEncryptedMessage extends Message {} as needed, assembling the classes based on configuration parameters eg $message = new SMIMESignedMessage( new SMIMEEncryptedMessage( new DKIMMessage( new Message( $header, $body )))); |
It would be lovely, but unfortunately since PHPMailer's popularity stems largely from legacy support, we can't really do BC breaks. There's a discussion in #88. |
hmmmm.... yes i see your point in #88. In theory it should be possible to completely rewrite phpmailer internally and create facade class to preserve the old interface using magic setters/getters for the properties, your existing PSR-2 methods etc. In reality, edge cases often get in the way. |
Does PHPmail allow to use end-to-end encryption now? Cant find any news for it? |
No, not yet. PRs very welcome though! |
@AZimmerhofer I just committed a subclass that does PGP signing / encryption and am looking for a few people to test / break it. If you're still interested, issue #505 might be for you. |
I might be a monkey wrench in the way of progress but here's a patch for the current master that does it native in 5.2.13.
Everything is PEM encoded and you have to sign it and encrypt it. ex.: |
Ups, now it 2018 and nothing really happend in SMIME-Encryption? This point will be more and more important for mail-frameworks ... |
Yes it will. Do you have a PR for it then? |
When I first wrote my piece above I had no clue about how to do a PR. Now I can barely do one. Let me know if that will help and I'll try not to cock it up too bad but if someone else can do it more easily feel free. |
@ratatine I put your patch in the 5.2.27 and it works well. Now I'll try it with 6.0.6. I'll give feedback next week. So you can make a PR ? :) |
@ratatine I would say it works perfectly even with 6.0.6. In 6 there was just a small modifiations for static-LE. |
That always takes me longer than I think it will. |
delighted stumble across your library today and to find your support for s/mime signatures. thanks for making an awesome tool!
is it possible to add s/mime encryption that works alongside s/mime signatures?
i found http://lamp-dev.com/smime-email-encryptionsigning-using-zend_mail/100 which has an example for zend framework 1 (which I'm reluctant to use because it patches the zend framework library). Sample code can be downloaded by clicking the "attachments" link near the bottom of the page.
The gymnastics that are listed in the comments of http://php.net/manual/en/function.openssl-pkcs7-encrypt.php show that it probably needs someone with a fair bit of expertise / experience to get it working...
The text was updated successfully, but these errors were encountered: