diff options
author | philsturgeon <devnull@localhost> | 2011-06-15 17:00:03 +0200 |
---|---|---|
committer | philsturgeon <devnull@localhost> | 2011-06-15 17:00:03 +0200 |
commit | 0fe54dbaf89a8337d27b9203f74891cf1a799715 (patch) | |
tree | ce168b3c24788e5a4a31e0cc65b64f54e25ee8a2 /user_guide/libraries/encryption.html | |
parent | 3a43c7adae7737d68a0eeca663cc2dd3fc5b0cf3 (diff) | |
parent | 3ef65bd7491f847fecdab1acc9687f0e90eee09b (diff) |
Merged Alex Bilbies MSSQL changes.
Diffstat (limited to 'user_guide/libraries/encryption.html')
-rw-r--r-- | user_guide/libraries/encryption.html | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/user_guide/libraries/encryption.html b/user_guide/libraries/encryption.html index f6fb2b81d..96ad54bc0 100644 --- a/user_guide/libraries/encryption.html +++ b/user_guide/libraries/encryption.html @@ -28,7 +28,7 @@ <div id="masthead"> <table cellpadding="0" cellspacing="0" border="0" style="width:100%"> <tr> -<td><h1>CodeIgniter User Guide Version 2.0.0</h1></td> +<td><h1>CodeIgniter User Guide Version 2.0.2</h1></td> <td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td> </tr> </table> @@ -58,9 +58,9 @@ Encryption Class <h1>Encryption Class</h1> -<p>The Encryption Class provides two-way data encryption. It uses a scheme that either compiles +<p>The Encryption Class provides two-way data encryption. It uses a scheme that either compiles the message using a randomly hashed bitwise XOR encoding scheme, or is encrypted using -the Mcrypt library. If Mcrypt is not available on your server the encoded message will +the Mcrypt library. If Mcrypt is not available on your server the encoded message will still provide a reasonable degree of security for encrypted sessions or other such "light" purposes. If Mcrypt is available, you'll be provided with a high degree of security appropriate for storage.</p> @@ -72,7 +72,7 @@ In fact, the key you chose will provide the <strong>only</strong> means to decod so not only must you choose the key carefully, you must never change it if you intend use it for persistent data.</p> <p>It goes without saying that you should guard your key carefully. -Should someone gain access to your key, the data will be easily decoded. If your server is not totally under your control +Should someone gain access to your key, the data will be easily decoded. If your server is not totally under your control it's impossible to ensure key security so you may want to think carefully before using it for anything that requires high security, like storing credit card numbers.</p> @@ -91,9 +91,9 @@ storage mechanism and pass the key dynamically when encoding/decoding.</p> <h2>Message Length</h2> <p>It's important for you to know that the encoded messages the encryption function generates will be approximately 2.6 times longer than the original -message. For example, if you encrypt the string "my super secret data", which is 21 characters in length, you'll end up +message. For example, if you encrypt the string "my super secret data", which is 21 characters in length, you'll end up with an encoded string that is roughly 55 characters (we say "roughly" because the encoded string length increments in -64 bit clusters, so it's not exactly linear). Keep this information in mind when selecting your data storage mechanism. Cookies, +64 bit clusters, so it's not exactly linear). Keep this information in mind when selecting your data storage mechanism. Cookies, for example, can only hold 4K of information.</p> @@ -124,7 +124,7 @@ $encrypted_string = $this->encrypt->encode($msg, $key);</code> <h2>$this->encrypt->decode()</h2> -<p>Decrypts an encoded string. Example:</p> +<p>Decrypts an encoded string. Example:</p> <code> $encrypted_string = 'APANtByIGI1BpVXZTJgcsAG8GZl8pdwwa84';<br /> @@ -142,9 +142,9 @@ $encrypted_string = $this->encrypt->decode($msg, $key);</code> <h2>$this->encrypt->set_cipher();</h2> -<p>Permits you to set an Mcrypt cipher. By default it uses <samp>MCRYPT_RIJNDAEL_256</samp>. Example:</p> +<p>Permits you to set an Mcrypt cipher. By default it uses <samp>MCRYPT_RIJNDAEL_256</samp>. Example:</p> <code>$this->encrypt->set_cipher(MCRYPT_BLOWFISH);</code> -<p>Please visit php.net for a list of <a href="http://php.net/mcrypt">available ciphers</a>.</p> +<p>Please visit php.net for a list of <a href="http://php.net/mcrypt">available ciphers</a>.</p> <p>If you'd like to manually test whether your server supports Mcrypt you can use:</p> <code>echo ( ! function_exists('mcrypt_encrypt')) ? 'Nope' : 'Yup';</code> @@ -152,13 +152,13 @@ $encrypted_string = $this->encrypt->decode($msg, $key);</code> <h2>$this->encrypt->set_mode();</h2> -<p>Permits you to set an Mcrypt mode. By default it uses <samp>MCRYPT_MODE_CBC</samp>. Example:</p> +<p>Permits you to set an Mcrypt mode. By default it uses <samp>MCRYPT_MODE_CBC</samp>. Example:</p> <code>$this->encrypt->set_mode(MCRYPT_MODE_CFB);</code> -<p>Please visit php.net for a list of <a href="http://php.net/mcrypt">available modes</a>.</p> +<p>Please visit php.net for a list of <a href="http://php.net/mcrypt">available modes</a>.</p> <h2>$this->encrypt->sha1();</h2> -<p>SHA1 encoding function. Provide a string and it will return a 160 bit one way hash. Note: SHA1, just like MD5 is non-decodable. Example:</p> +<p>SHA1 encoding function. Provide a string and it will return a 160 bit one way hash. Note: SHA1, just like MD5 is non-decodable. Example:</p> <code>$hash = $this->encrypt->sha1('Some string');</code> <p>Many PHP installations have SHA1 support by default so if all you need is to encode a hash it's simpler to use the native @@ -169,12 +169,12 @@ function:</p> <p>If your server does not support SHA1 you can use the provided function.</p> <h2 id="legacy">$this->encrypt->encode_from_legacy(<kbd>$orig_data</kbd>, <kbd>$legacy_mode</kbd> = MCRYPT_MODE_ECB, <kbd>$key</kbd> = '');</h2> -<p>Enables you to re-encode data that was originally encrypted with CodeIgniter 1.x to be compatible with the Encryption library in CodeIgniter 2.x. It is only - necessary to use this method if you have encrypted data stored permanently such as in a file or database and are on a server that supports Mcrypt. "Light" use encryption - such as encrypted session data or transitory encrypted flashdata require no intervention on your part. However, existing encrypted Sessions will be +<p>Enables you to re-encode data that was originally encrypted with CodeIgniter 1.x to be compatible with the Encryption library in CodeIgniter 2.x. It is only + necessary to use this method if you have encrypted data stored permanently such as in a file or database and are on a server that supports Mcrypt. "Light" use encryption + such as encrypted session data or transitory encrypted flashdata require no intervention on your part. However, existing encrypted Sessions will be destroyed since data encrypted prior to 2.x will not be decoded.</p> -<p class="important"><strong>Why only a method to re-encode the data instead of maintaining legacy methods for both encoding and decoding?</strong> The algorithms in +<p class="important"><strong>Why only a method to re-encode the data instead of maintaining legacy methods for both encoding and decoding?</strong> The algorithms in the Encryption library have improved in CodeIgniter 2.x both for performance and security, and we do not wish to encourage continued use of the older methods. You can of course extend the Encryption library if you wish and replace the new methods with the old and retain seamless compatibility with CodeIgniter 1.x encrypted data, but this a decision that a developer should make cautiously and deliberately, if at all.</p> @@ -195,13 +195,13 @@ function:</p> <tr> <td class="td"><strong>$legacy_mode</strong></td> <td class="td">MCRYPT_MODE_ECB</td> - <td class="td">The Mcrypt mode that was used to generate the original encrypted data. CodeIgniter 1.x's default was MCRYPT_MODE_ECB, and it will + <td class="td">The Mcrypt mode that was used to generate the original encrypted data. CodeIgniter 1.x's default was MCRYPT_MODE_ECB, and it will assume that to be the case unless overridden by this parameter.</td> </tr> <tr> <td class="td"><strong>$key</strong></td> <td class="td">n/a</td> - <td class="td">The encryption key. This it typically specified in your config file as outlined above.</td> + <td class="td">The encryption key. This it typically specified in your config file as outlined above.</td> </tr> </table> |