summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/libraries/encryption.rst
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2015-03-08 21:15:57 +0100
committerAndrey Andreev <narf@devilix.net>2015-03-08 21:15:57 +0100
commite7a3096b9cbd7c95bf4240c5233c7d14eb112305 (patch)
tree483c5e5de5aa2a353bc09f349f3a6a76576cd84c /user_guide_src/source/libraries/encryption.rst
parent99776058b0a08865e75efb7380fdbc2de234f26e (diff)
[ci skip] Update CI_Encryption docs
Close #3647
Diffstat (limited to 'user_guide_src/source/libraries/encryption.rst')
-rw-r--r--user_guide_src/source/libraries/encryption.rst21
1 files changed, 21 insertions, 0 deletions
diff --git a/user_guide_src/source/libraries/encryption.rst b/user_guide_src/source/libraries/encryption.rst
index d445bf42f..5f0979da7 100644
--- a/user_guide_src/source/libraries/encryption.rst
+++ b/user_guide_src/source/libraries/encryption.rst
@@ -106,6 +106,18 @@ and set::
$config['encryption_key'] = 'YOUR KEY';
+You'll notice that the ``create_key()`` method outputs binary data, which
+is hard to deal with (i.e. a copy-paste may damage it), so you may use
+``bin2hex()``, ``hex2bin()`` or Base64-encoding to work with the key in
+a more friendly manner. For example::
+
+ // Get a hex-encoded representation of the key:
+ $key = bin2hex($this->encryption->create_key(16));
+
+ // Put the same value in your config with hex2bin(),
+ // so that it is still passed as binary to the library:
+ $config['encryption_key'] = hex2bin(<your hex-encoded key>);
+
.. _ciphers-and-modes:
Supported encryption ciphers and modes
@@ -525,6 +537,15 @@ Class Reference
Please refer to the :ref:`custom-parameters` secrion for information
on the optional parameters.
+ .. php:method:: create_key($length)
+
+ :param int $length: Output length
+ :returns: A pseudo-random cryptographic key with the specified length, or FALSE on failure
+ :rtype: string
+
+ Creates a cryptographic key by fetching random data from
+ the operating system's sources (i.e. /dev/urandom).
+
.. php:method:: hkdf($key[, $digest = 'sha512'[, $salt = NULL[, $length = NULL[, $info = '']]]])
:param string $key: Input key material