Continued a bit:
[core.git] / framework / main / classes / crypto / class_CryptoHelper.php
index b404317243265d7960599e4d6da74e96c109448d..6ee9c1717c11ab2b0e6d03f9f03b1a07cfa1a35e 100644 (file)
@@ -101,13 +101,17 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
         * @return      void
         */
        protected function attachCryptoStream () {
-               // Do we have mcrypt loaded?
+               // @TODO Maybe rewrite this with DirectoryIterator, similar to Compressor thing?
+               // Do we have openssl/mcrypt loaded?
                if ($this->isPhpExtensionLoaded('mcrypt')) {
                        // Then use it
-                       $this->cryptoStreamInstance = ObjectFactory::createObjectByName('McryptStream', array($this->getRngInstance()));
+                       $this->cryptoStreamInstance = ObjectFactory::createObjectByName('CoreFramework\Stream\Crypto\McryptStream', array($this->getRngInstance()));
+               } elseif ($this->isPhpExtensionLoaded('openssl')) {
+                       // Then use it
+                       $this->cryptoStreamInstance = ObjectFactory::createObjectByName('CoreFramework\Stream\Crypto\OpenSslStream', array($this->getRngInstance()));
                } else {
                        // If nothing works ...
-                       $this->cryptoStreamInstance = ObjectFactory::createObjectByName('NullCryptoStream');
+                       $this->cryptoStreamInstance = ObjectFactory::createObjectByName('CoreFramework\Stream\Crypto\NullCryptoStream');
                }
        }