owncloud/core — pull request #10642 by LukasReschke (2014-08-26 17:20:49+00:00)
Title: Add some security utilities

This adds some security utilities to core including:
- A library for basic crypto operations
- This is especially useful because now a lot of our application use their own crypto for some operations (e.g. obfuscate passwords), while a central solution should be obviously preferred
- ` $encryptWithDefaultPassword = \OC::$server->getCrypto()->encrypt('EncryptedText');`
- `$encryptWithCustomPassword = \OC::$server->getCrypto()->encrypt('EncryptedText', 'password');`
- A better library for random numbers
- Mixes several sources as specified in [RFC 4086 Section 5.2](http://tools.ietf.org/html/rfc4086#section-5.2)
- Supports different strengths. Specifically: low and medium
- `\OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate(10);`
- `\OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(10);`
- Allows to specify a charset
- `\OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate(10, 'abc');`
- A library for secure string comparisons
- This is helpful against Timing Attacks. We have some workarounds in the code where we do this manually, but we should solve it centrally.

@DeepDiver1975 @karlitschek