Skip to content
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

Improve encryption strength for session passwords #4492

Closed
rcubetrac opened this issue Mar 24, 2014 · 6 comments
Closed

Improve encryption strength for session passwords #4492

rcubetrac opened this issue Mar 24, 2014 · 6 comments

Comments

@rcubetrac
Copy link

Reported by @thomascube on 24 Mar 2014 08:00 UTC as Trac ticket #1489719

Using Mcrypt and this nifty wrapper class:

http://stackoverflow.com/questions/5089841/php-2-way-encryption-i-need-to-store-passwords-that-can-be-retrieved

Migrated-From: http://trac.roundcube.net/ticket/1489719

@rcubetrac
Copy link
Author

Comment by @alecpl on 24 Mar 2014 08:33 UTC

The class author says "an encryption and decryption cycle takes about 1/2 second on my machine" which might be noticeable in our case (we decrypt password on every IMAP login). We should check performance impact.

@rcubetrac
Copy link
Author

Comment by @alecpl on 2 Sep 2015 17:53 UTC

Our current implementation based on openssl_encrypt() is good enough. Some sources discourage use of mcrypt e.g. http://thefsb.tumblr.com/post/110749271235/using-opensslendecrypt-in-php-instead-of.

The only thing to consider is algorithm we use. Maybe using AES instead of 3DES would give us more security (and/or performance). Starting from PHP7 we could use also better random_bytes generator (http://php.net/manual/en/function.random-bytes.php).

@rcubetrac
Copy link
Author

Comment by @alecpl on 2 Sep 2015 18:29 UTC

On my laptop with PHP7, encrypt+decrypt methods using AES-256-CBC algorithm is 100% faster than with DES-EDE3-CBC. Also, I see we can get rid of the canary byte and padding handling.

@rcubetrac
Copy link
Author

Milestone changed by @alecpl on 2 Sep 2015 18:29 UTC

later => 1.2-beta

@rcubetrac
Copy link
Author

Comment by @alecpl on 7 Sep 2015 07:49 UTC

Fixed in e4c6608. Added cipher_method option, which defaults to 'DES-EDE3-CBC' for bachward compatibility. Also removed canary byte and padding handling. Finally, des_key don't need to be 24-chars long anymore.

@rcubetrac
Copy link
Author

Status changed by @alecpl on 7 Sep 2015 07:49 UTC

new => closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant