Added parameter 'key' to encryption methods to allow own keys
[core.git] / inc / classes / main / crypto / class_CryptoHelper.php
index 4e9cc4a6146cca4512bda09697bc15fdf4893766..5e40560622673b8b4d4e6d83a300eb14e7f3eb86 100644 (file)
@@ -179,11 +179,12 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
         * Encrypt the string with fixed salt
         *
         * @param       $str            The unencrypted string
+        * @param       $key            Optional key, if none provided, a random key will be generated
         * @return      $encrypted      Encrypted string
         */
-       public function encryptString ($str) {
+       public function encryptString ($str, $key = null) {
                // Encrypt the string through the stream
-               $encrypted = $this->cryptoStreamInstance->encryptStream($str);
+               $encrypted = $this->cryptoStreamInstance->encryptStream($str, $key);
 
                // Return the string
                return $encrypted;