diff --git a/reference/mcrypt/book.xml b/reference/mcrypt/book.xml new file mode 100644 index 0000000000..620010c538 --- /dev/null +++ b/reference/mcrypt/book.xml @@ -0,0 +1,50 @@ + + + + + + + Mcrypt Encryption + + + + &reftitle.intro; + + This is an interface to the mcrypt library, which supports a wide + variety of block algorithms such as DES, TripleDES, Blowfish + (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and + GOST in CBC, OFB, CFB and ECB cipher modes. Additionally, it + supports RC6 and IDEA which are considered "non-free". + + + + + &reference.mcrypt.setup; + &reference.mcrypt.constants; + &reference.mcrypt.ciphers; + &reference.mcrypt.examples; + &reference.mcrypt.reference; + + + + + diff --git a/reference/mcrypt/ciphers.xml b/reference/mcrypt/ciphers.xml new file mode 100644 index 0000000000..920c3af116 --- /dev/null +++ b/reference/mcrypt/ciphers.xml @@ -0,0 +1,91 @@ + + + + + Mcrypt ciphers + + Here is a list of ciphers which are currently supported by the mcrypt + extension. For a complete list of supported ciphers, see the defines at + the end of mcrypt.h. The general rule with the + mcrypt-2.2.x API is that you can access the cipher from PHP with + MCRYPT_ciphername. With the libmcrypt-2.4.x and libmcrypt-2.5.x API these constants also work, + but it is possible to specify the name of the cipher as a string with a + call to mcrypt_module_open. + + MCRYPT_3DES + MCRYPT_ARCFOUR_IV (libmcrypt > 2.4.x only) + MCRYPT_ARCFOUR (libmcrypt > 2.4.x only) + MCRYPT_BLOWFISH + MCRYPT_CAST_128 + MCRYPT_CAST_256 + MCRYPT_CRYPT + MCRYPT_DES + MCRYPT_DES_COMPAT (libmcrypt 2.2.x only) + MCRYPT_ENIGMA (libmcrypt > 2.4.x only, alias for MCRYPT_CRYPT) + MCRYPT_GOST + MCRYPT_IDEA (non-free) + MCRYPT_LOKI97 (libmcrypt > 2.4.x only) + MCRYPT_MARS (libmcrypt > 2.4.x only, non-free) + MCRYPT_PANAMA (libmcrypt > 2.4.x only) + MCRYPT_RIJNDAEL_128 (libmcrypt > 2.4.x only) + MCRYPT_RIJNDAEL_192 (libmcrypt > 2.4.x only) + MCRYPT_RIJNDAEL_256 (libmcrypt > 2.4.x only) + MCRYPT_RC2 + MCRYPT_RC4 (libmcrypt 2.2.x only) + MCRYPT_RC6 (libmcrypt > 2.4.x only) + MCRYPT_RC6_128 (libmcrypt 2.2.x only) + MCRYPT_RC6_192 (libmcrypt 2.2.x only) + MCRYPT_RC6_256 (libmcrypt 2.2.x only) + MCRYPT_SAFER64 + MCRYPT_SAFER128 + MCRYPT_SAFERPLUS (libmcrypt > 2.4.x only) + MCRYPT_SERPENT(libmcrypt > 2.4.x only) + MCRYPT_SERPENT_128 (libmcrypt 2.2.x only) + MCRYPT_SERPENT_192 (libmcrypt 2.2.x only) + MCRYPT_SERPENT_256 (libmcrypt 2.2.x only) + MCRYPT_SKIPJACK (libmcrypt > 2.4.x only) + MCRYPT_TEAN (libmcrypt 2.2.x only) + MCRYPT_THREEWAY + MCRYPT_TRIPLEDES (libmcrypt > 2.4.x only) + MCRYPT_TWOFISH (for older mcrypt 2.x versions, or mcrypt > 2.4.x ) + MCRYPT_TWOFISH128 (TWOFISHxxx are available in newer 2.x versions, but not in the 2.4.x versions) + MCRYPT_TWOFISH192 + MCRYPT_TWOFISH256 + MCRYPT_WAKE (libmcrypt > 2.4.x only) + MCRYPT_XTEA (libmcrypt > 2.4.x only) + + + + You must (in CFB and OFB mode) or can (in CBC mode) supply an + initialization vector (IV) to the respective cipher function. The + IV must be unique and must be the same when + decrypting/encrypting. With data which is stored encrypted, you + can take the output of a function of the index under which the + data is stored (e.g. the MD5 key of the filename). + Alternatively, you can transmit the IV together with the encrypted + data (see chapter 9.3 of &book.applied.cryptography; for a + discussion of this topic). + + + + + diff --git a/reference/mcrypt/constants.xml b/reference/mcrypt/constants.xml index b364d3e286..9ab0acb549 100644 --- a/reference/mcrypt/constants.xml +++ b/reference/mcrypt/constants.xml @@ -1,6 +1,6 @@ - -
+ + &reftitle.constants; &extension.constants; @@ -114,7 +114,7 @@ -
+ + + + &reftitle.examples; + + Mcrypt can be used to encrypt and decrypt using the above + mentioned ciphers. If you linked against libmcrypt-2.2.x, the + four important mcrypt commands (mcrypt_cfb, + mcrypt_cbc, mcrypt_ecb, + and mcrypt_ofb) can operate in both modes + which are named MCRYPT_ENCRYPT and MCRYPT_DECRYPT, respectively. + + Encrypt an input value with TripleDES under 2.2.x in ECB mode + + +]]> + + + This example will give you the encrypted data as a string in + $encrypted_data. + + + If you linked against libmcrypt 2.4.x or 2.5.x, these functions are still + available, but it is recommended that you use the advanced functions. + + Encrypt an input value with TripleDES under 2.4.x and higher in ECB mode + + +]]> + + + This example will give you the encrypted data as a string in + $encrypted_data. For a full example see + mcrypt_module_open. + + + + diff --git a/reference/mcrypt/reference.xml b/reference/mcrypt/reference.xml index e928b1dfab..670391f76c 100644 --- a/reference/mcrypt/reference.xml +++ b/reference/mcrypt/reference.xml @@ -1,182 +1,14 @@ - - - + - - Mcrypt Encryption Functions - mcrypt - - -
- &reftitle.intro; - - This is an interface to the mcrypt library, which supports a wide - variety of block algorithms such as DES, TripleDES, Blowfish - (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and - GOST in CBC, OFB, CFB and ECB cipher modes. Additionally, it - supports RC6 and IDEA which are considered "non-free". - -
+ + Mcrypt Encryption &Functions; + mcrypt -
- &reftitle.required; - - These functions work using mcrypt. - To use it, download libmcrypt-x.x.tar.gz from &url.mcrypt; and follow the included - installation instructions. Windows users will find all the - needed compiled mcrypt binaries at - &url.mcrypt.windows;. - - - As of PHP 5.0.0 you will need libmcrypt Version 2.5.6 or greater. - - - If you linked against libmcrypt 2.4.x or higher, the following additional - block algorithms are supported: CAST, LOKI97, RIJNDAEL, SAFERPLUS, - SERPENT and the following stream ciphers: ENIGMA (crypt), PANAMA, RC4 and - WAKE. With libmcrypt 2.4.x or higher another cipher mode is also - available; nOFB. - -
+ &reference.mcrypt.entities.functions; - &reference.mcrypt.configure; +
- &reference.mcrypt.ini; - -
- &reftitle.resources; - - mcrypt_module_open returns an encryption descriptor. - -
- - &reference.mcrypt.constants; - -
- Mcrypt ciphers - - Here is a list of ciphers which are currently supported by the mcrypt - extension. For a complete list of supported ciphers, see the defines at - the end of mcrypt.h. The general rule with the - mcrypt-2.2.x API is that you can access the cipher from PHP with - MCRYPT_ciphername. With the libmcrypt-2.4.x and libmcrypt-2.5.x API these constants also work, - but it is possible to specify the name of the cipher as a string with a - call to mcrypt_module_open. - - MCRYPT_3DES - MCRYPT_ARCFOUR_IV (libmcrypt > 2.4.x only) - MCRYPT_ARCFOUR (libmcrypt > 2.4.x only) - MCRYPT_BLOWFISH - MCRYPT_CAST_128 - MCRYPT_CAST_256 - MCRYPT_CRYPT - MCRYPT_DES - MCRYPT_DES_COMPAT (libmcrypt 2.2.x only) - MCRYPT_ENIGMA (libmcrypt > 2.4.x only, alias for MCRYPT_CRYPT) - MCRYPT_GOST - MCRYPT_IDEA (non-free) - MCRYPT_LOKI97 (libmcrypt > 2.4.x only) - MCRYPT_MARS (libmcrypt > 2.4.x only, non-free) - MCRYPT_PANAMA (libmcrypt > 2.4.x only) - MCRYPT_RIJNDAEL_128 (libmcrypt > 2.4.x only) - MCRYPT_RIJNDAEL_192 (libmcrypt > 2.4.x only) - MCRYPT_RIJNDAEL_256 (libmcrypt > 2.4.x only) - MCRYPT_RC2 - MCRYPT_RC4 (libmcrypt 2.2.x only) - MCRYPT_RC6 (libmcrypt > 2.4.x only) - MCRYPT_RC6_128 (libmcrypt 2.2.x only) - MCRYPT_RC6_192 (libmcrypt 2.2.x only) - MCRYPT_RC6_256 (libmcrypt 2.2.x only) - MCRYPT_SAFER64 - MCRYPT_SAFER128 - MCRYPT_SAFERPLUS (libmcrypt > 2.4.x only) - MCRYPT_SERPENT(libmcrypt > 2.4.x only) - MCRYPT_SERPENT_128 (libmcrypt 2.2.x only) - MCRYPT_SERPENT_192 (libmcrypt 2.2.x only) - MCRYPT_SERPENT_256 (libmcrypt 2.2.x only) - MCRYPT_SKIPJACK (libmcrypt > 2.4.x only) - MCRYPT_TEAN (libmcrypt 2.2.x only) - MCRYPT_THREEWAY - MCRYPT_TRIPLEDES (libmcrypt > 2.4.x only) - MCRYPT_TWOFISH (for older mcrypt 2.x versions, or mcrypt > 2.4.x ) - MCRYPT_TWOFISH128 (TWOFISHxxx are available in newer 2.x versions, but not in the 2.4.x versions) - MCRYPT_TWOFISH192 - MCRYPT_TWOFISH256 - MCRYPT_WAKE (libmcrypt > 2.4.x only) - MCRYPT_XTEA (libmcrypt > 2.4.x only) - - - - You must (in CFB and OFB mode) or can (in CBC mode) supply an - initialization vector (IV) to the respective cipher function. The - IV must be unique and must be the same when - decrypting/encrypting. With data which is stored encrypted, you - can take the output of a function of the index under which the - data is stored (e.g. the MD5 key of the filename). - Alternatively, you can transmit the IV together with the encrypted - data (see chapter 9.3 of &book.applied.cryptography; for a - discussion of this topic). - -
- -
- &reftitle.examples; - - Mcrypt can be used to encrypt and decrypt using the above - mentioned ciphers. If you linked against libmcrypt-2.2.x, the - four important mcrypt commands (mcrypt_cfb, - mcrypt_cbc, mcrypt_ecb, - and mcrypt_ofb) can operate in both modes - which are named MCRYPT_ENCRYPT and MCRYPT_DECRYPT, respectively. - - Encrypt an input value with TripleDES under 2.2.x in ECB mode - - -]]> - - - This example will give you the encrypted data as a string in - $encrypted_data. - - - If you linked against libmcrypt 2.4.x or 2.5.x, these functions are still - available, but it is recommended that you use the advanced functions. - - Encrypt an input value with TripleDES under 2.4.x and higher in ECB mode - - -]]> - - - This example will give you the encrypted data as a string in - $encrypted_data. For a full example see - mcrypt_module_open. - -
-
- -&reference.mcrypt.entities.functions; - -
+ + + &reftitle.setup; + + +
+ &reftitle.required; + + These functions work using mcrypt. + To use it, download libmcrypt-x.x.tar.gz from &url.mcrypt; and follow the included + installation instructions. Windows users will find all the + needed compiled mcrypt binaries at + &url.mcrypt.windows;. + + + As of PHP 5.0.0 you will need libmcrypt Version 2.5.6 or greater. + + + If you linked against libmcrypt 2.4.x or higher, the following additional + block algorithms are supported: CAST, LOKI97, RIJNDAEL, SAFERPLUS, + SERPENT and the following stream ciphers: ENIGMA (crypt), PANAMA, RC4 and + WAKE. With libmcrypt 2.4.x or higher another cipher mode is also + available; nOFB. + +
+ + + + &reference.mcrypt.configure; + + + + &reference.mcrypt.ini; + + + +
+ &reftitle.resources; + + mcrypt_module_open returns an encryption descriptor. + +
+ + +
+ + +