com.caucho.quercus.lib.mcrypt
Class McryptModule

java.lang.Object
  extended by com.caucho.quercus.module.AbstractQuercusModule
      extended by com.caucho.quercus.lib.mcrypt.McryptModule
All Implemented Interfaces:
QuercusModule

public class McryptModule
extends AbstractQuercusModule

PHP encryption


Field Summary
static java.lang.String MCRYPT_3DES
           
static java.lang.String MCRYPT_ARCFOUR
           
static java.lang.String MCRYPT_BLOWFISH
           
static int MCRYPT_DECRYPT
           
static java.lang.String MCRYPT_DES
           
static int MCRYPT_DEV_RANDOM
           
static int MCRYPT_DEV_URANDOM
           
static int MCRYPT_ENCRYPT
           
static java.lang.String MCRYPT_MODE_CBC
           
static java.lang.String MCRYPT_MODE_CFB
           
static java.lang.String MCRYPT_MODE_ECB
           
static java.lang.String MCRYPT_MODE_NOFB
           
static java.lang.String MCRYPT_MODE_OFB
           
static java.lang.String MCRYPT_MODE_STREAM
           
static int MCRYPT_RAND
           
static java.lang.String MCRYPT_RC4
           
static java.lang.String MCRYPT_RIJNDAEL_128
           
static java.lang.String MCRYPT_RIJNDAEL_192
           
static java.lang.String MCRYPT_RIJNDAEL_256
           
static java.lang.String MCRYPT_TRIPLEDES
           
 
Fields inherited from class com.caucho.quercus.module.AbstractQuercusModule
PHP_INI_ALL, PHP_INI_PERDIR, PHP_INI_SYSTEM, PHP_INI_USER
 
Constructor Summary
McryptModule()
           
 
Method Summary
 java.lang.String[] getLoadedExtensions()
          Returns the extensions loaded by the module.
static StringValue mcrypt_cbc(Env env, java.lang.String cipher, byte[] key, byte[] data, int mode, byte[] iv)
          Encrypt with cbc
static StringValue mcrypt_cfb(Env env, java.lang.String cipher, byte[] key, byte[] data, int mode, byte[] iv)
          Encrypt with cfb
static StringValue mcrypt_create_iv(Env env, int size, int randomMode)
          Creates the IV vector.
static StringValue mcrypt_decrypt(Env env, java.lang.String cipher, byte[] key, byte[] data, java.lang.String mode, byte[] iv)
          Decrypt
static StringValue mcrypt_ecb(Env env, java.lang.String cipher, byte[] key, byte[] data, int mode, byte[] iv)
          Encrypt with cfb
static java.lang.String mcrypt_enc_get_algorithms_name(Mcrypt mcrypt)
          Returns the algorithms name
static int mcrypt_enc_get_block_size(Mcrypt mcrypt)
          Returns the block size
static int mcrypt_enc_get_iv_size(Mcrypt mcrypt)
          Returns the IV size
static int mcrypt_enc_get_key_size(Mcrypt mcrypt)
          Returns the key size
static java.lang.String mcrypt_enc_get_modes_name(Mcrypt mcrypt)
          Returns the mode name
static Value mcrypt_enc_get_supported_key_sizes(Mcrypt mcrypt)
          Returns the supported key sizes
static boolean mcrypt_enc_is_block_algorithm_mode(Mcrypt mcrypt)
          Returns true for block encoding modes
static boolean mcrypt_enc_is_block_algorithm(Mcrypt mcrypt)
          Returns true for block encoding modes
static boolean mcrypt_enc_is_block_mode(Mcrypt mcrypt)
          Returns true for block output modes
static boolean mcrypt_enc_self_test(Mcrypt mcrypt)
          Returns true for block output modes
static StringValue mcrypt_encrypt(Env env, java.lang.String cipher, byte[] key, byte[] data, java.lang.String mode, byte[] iv)
          Encrypt
static boolean mcrypt_generic_deinit(Mcrypt mcrypt)
          Initialize encrption
static boolean mcrypt_generic_end(Mcrypt mcrypt)
          Closes the module
static Value mcrypt_generic_init(Mcrypt mcrypt, byte[] key, byte[] iv)
          Initialize encrption
static StringValue mcrypt_generic(Env env, Mcrypt mcrypt, byte[] data)
          Initialize encrption
static Value mcrypt_get_block_size(Env env, java.lang.String cipher, java.lang.String mode)
           
static java.lang.String mcrypt_get_cipher_name(Env env, java.lang.String cipher)
           
static Value mcrypt_get_iv_size(Env env, java.lang.String cipher, java.lang.String mode)
           
static Value mcrypt_get_key_size(Env env, java.lang.String cipher, java.lang.String mode)
           
static Value mcrypt_list_algorithms(Env env)
          Lists the available algorithms
static Value mcrypt_list_modes(Env env)
          Lists the available modes.
static boolean mcrypt_module_close(Mcrypt mcrypt)
          Closes the module
static int mcrypt_module_get_algo_block_size(Env env, java.lang.String cipher, java.lang.String libDir)
          Returns the block size for an algorithm.
static int mcrypt_module_get_algo_key_size(Env env, java.lang.String cipher, java.lang.String libDir)
          Returns the key size for an algorithm.
static Value mcrypt_module_get_supported_key_sizes(Env env, java.lang.String cipher, java.lang.String libDir)
          Returns the key size for an algorithm.
static boolean mcrypt_module_is_block_algorithm_mode(Env env, java.lang.String mode, java.lang.String libDir)
          Returns true for block modes
static boolean mcrypt_module_is_block_algorithm(Env env, java.lang.String cipher, java.lang.String libDir)
          Returns true for block algorithms
static boolean mcrypt_module_is_block_mode(Env env, java.lang.String mode, java.lang.String libDir)
          Returns true for block modes
static Value mcrypt_module_open(Env env, java.lang.String algorithm, Path algorithm_directory, java.lang.String mode, Path mode_directory)
          Open a new mcrypt object.
static boolean mcrypt_module_self_test(Env env, java.lang.String algorithm, Path libDir)
          Returns true for block modes
static StringValue mcrypt_ofb(Env env, java.lang.String cipher, byte[] key, byte[] data, int mode, byte[] iv)
          Encrypt with ofb
static Value mdecrypt_generic(Env env, Mcrypt mcrypt, byte[] data)
          Initialize encrption
 
Methods inherited from class com.caucho.quercus.module.AbstractQuercusModule
getConstMap, getIniDefinitions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MCRYPT_DEV_RANDOM

public static final int MCRYPT_DEV_RANDOM
See Also:
Constant Field Values

MCRYPT_DEV_URANDOM

public static final int MCRYPT_DEV_URANDOM
See Also:
Constant Field Values

MCRYPT_RAND

public static final int MCRYPT_RAND
See Also:
Constant Field Values

MCRYPT_ENCRYPT

public static final int MCRYPT_ENCRYPT
See Also:
Constant Field Values

MCRYPT_DECRYPT

public static final int MCRYPT_DECRYPT
See Also:
Constant Field Values

MCRYPT_MODE_ECB

public static final java.lang.String MCRYPT_MODE_ECB
See Also:
Constant Field Values

MCRYPT_MODE_CBC

public static final java.lang.String MCRYPT_MODE_CBC
See Also:
Constant Field Values

MCRYPT_MODE_CFB

public static final java.lang.String MCRYPT_MODE_CFB
See Also:
Constant Field Values

MCRYPT_MODE_OFB

public static final java.lang.String MCRYPT_MODE_OFB
See Also:
Constant Field Values

MCRYPT_MODE_NOFB

public static final java.lang.String MCRYPT_MODE_NOFB
See Also:
Constant Field Values

MCRYPT_MODE_STREAM

public static final java.lang.String MCRYPT_MODE_STREAM
See Also:
Constant Field Values

MCRYPT_ARCFOUR

public static final java.lang.String MCRYPT_ARCFOUR
See Also:
Constant Field Values

MCRYPT_BLOWFISH

public static final java.lang.String MCRYPT_BLOWFISH
See Also:
Constant Field Values

MCRYPT_DES

public static final java.lang.String MCRYPT_DES
See Also:
Constant Field Values

MCRYPT_3DES

public static final java.lang.String MCRYPT_3DES
See Also:
Constant Field Values

MCRYPT_TRIPLEDES

public static final java.lang.String MCRYPT_TRIPLEDES
See Also:
Constant Field Values

MCRYPT_RC4

public static final java.lang.String MCRYPT_RC4
See Also:
Constant Field Values

MCRYPT_RIJNDAEL_128

public static final java.lang.String MCRYPT_RIJNDAEL_128
See Also:
Constant Field Values

MCRYPT_RIJNDAEL_192

public static final java.lang.String MCRYPT_RIJNDAEL_192
See Also:
Constant Field Values

MCRYPT_RIJNDAEL_256

public static final java.lang.String MCRYPT_RIJNDAEL_256
See Also:
Constant Field Values
Constructor Detail

McryptModule

public McryptModule()
Method Detail

getLoadedExtensions

public java.lang.String[] getLoadedExtensions()
Description copied from class: AbstractQuercusModule
Returns the extensions loaded by the module.

Specified by:
getLoadedExtensions in interface QuercusModule
Overrides:
getLoadedExtensions in class AbstractQuercusModule

mcrypt_cbc

public static StringValue mcrypt_cbc(Env env,
                                     java.lang.String cipher,
                                     byte[] key,
                                     byte[] data,
                                     int mode,
                                     byte[] iv)
Encrypt with cbc


mcrypt_cfb

public static StringValue mcrypt_cfb(Env env,
                                     java.lang.String cipher,
                                     byte[] key,
                                     byte[] data,
                                     int mode,
                                     byte[] iv)
Encrypt with cfb


mcrypt_create_iv

public static StringValue mcrypt_create_iv(Env env,
                                           int size,
                                           int randomMode)
Creates the IV vector.


mcrypt_decrypt

public static StringValue mcrypt_decrypt(Env env,
                                         java.lang.String cipher,
                                         byte[] key,
                                         byte[] data,
                                         java.lang.String mode,
                                         byte[] iv)
Decrypt


mcrypt_ecb

public static StringValue mcrypt_ecb(Env env,
                                     java.lang.String cipher,
                                     byte[] key,
                                     byte[] data,
                                     int mode,
                                     byte[] iv)
Encrypt with cfb


mcrypt_enc_get_algorithms_name

public static java.lang.String mcrypt_enc_get_algorithms_name(Mcrypt mcrypt)
Returns the algorithms name


mcrypt_enc_get_block_size

public static int mcrypt_enc_get_block_size(Mcrypt mcrypt)
Returns the block size


mcrypt_enc_get_iv_size

public static int mcrypt_enc_get_iv_size(Mcrypt mcrypt)
Returns the IV size


mcrypt_enc_get_key_size

public static int mcrypt_enc_get_key_size(Mcrypt mcrypt)
Returns the key size


mcrypt_enc_get_modes_name

public static java.lang.String mcrypt_enc_get_modes_name(Mcrypt mcrypt)
Returns the mode name


mcrypt_enc_get_supported_key_sizes

public static Value mcrypt_enc_get_supported_key_sizes(Mcrypt mcrypt)
Returns the supported key sizes


mcrypt_enc_is_block_algorithm

public static boolean mcrypt_enc_is_block_algorithm(Mcrypt mcrypt)
Returns true for block encoding modes


mcrypt_enc_is_block_algorithm_mode

public static boolean mcrypt_enc_is_block_algorithm_mode(Mcrypt mcrypt)
Returns true for block encoding modes


mcrypt_enc_is_block_mode

public static boolean mcrypt_enc_is_block_mode(Mcrypt mcrypt)
Returns true for block output modes


mcrypt_enc_self_test

public static boolean mcrypt_enc_self_test(Mcrypt mcrypt)
Returns true for block output modes


mcrypt_encrypt

public static StringValue mcrypt_encrypt(Env env,
                                         java.lang.String cipher,
                                         byte[] key,
                                         byte[] data,
                                         java.lang.String mode,
                                         byte[] iv)
Encrypt


mcrypt_generic

public static StringValue mcrypt_generic(Env env,
                                         Mcrypt mcrypt,
                                         byte[] data)
Initialize encrption


mcrypt_generic_deinit

public static boolean mcrypt_generic_deinit(Mcrypt mcrypt)
Initialize encrption


mcrypt_generic_init

public static Value mcrypt_generic_init(Mcrypt mcrypt,
                                        byte[] key,
                                        byte[] iv)
Initialize encrption


mcrypt_generic_end

public static boolean mcrypt_generic_end(Mcrypt mcrypt)
Closes the module


mcrypt_get_block_size

public static Value mcrypt_get_block_size(Env env,
                                          java.lang.String cipher,
                                          java.lang.String mode)

mcrypt_get_cipher_name

public static java.lang.String mcrypt_get_cipher_name(Env env,
                                                      java.lang.String cipher)

mcrypt_get_iv_size

public static Value mcrypt_get_iv_size(Env env,
                                       java.lang.String cipher,
                                       java.lang.String mode)

mcrypt_get_key_size

public static Value mcrypt_get_key_size(Env env,
                                        java.lang.String cipher,
                                        java.lang.String mode)

mcrypt_list_algorithms

public static Value mcrypt_list_algorithms(Env env)
Lists the available algorithms


mcrypt_list_modes

public static Value mcrypt_list_modes(Env env)
Lists the available modes.


mcrypt_module_close

public static boolean mcrypt_module_close(Mcrypt mcrypt)
Closes the module


mcrypt_module_get_algo_block_size

public static int mcrypt_module_get_algo_block_size(Env env,
                                                    java.lang.String cipher,
                                                    java.lang.String libDir)
Returns the block size for an algorithm.


mcrypt_module_get_algo_key_size

public static int mcrypt_module_get_algo_key_size(Env env,
                                                  java.lang.String cipher,
                                                  java.lang.String libDir)
Returns the key size for an algorithm.


mcrypt_module_get_supported_key_sizes

public static Value mcrypt_module_get_supported_key_sizes(Env env,
                                                          java.lang.String cipher,
                                                          java.lang.String libDir)
Returns the key size for an algorithm.


mcrypt_module_is_block_algorithm

public static boolean mcrypt_module_is_block_algorithm(Env env,
                                                       java.lang.String cipher,
                                                       java.lang.String libDir)
Returns true for block algorithms


mcrypt_module_is_block_algorithm_mode

public static boolean mcrypt_module_is_block_algorithm_mode(Env env,
                                                            java.lang.String mode,
                                                            java.lang.String libDir)
Returns true for block modes


mcrypt_module_is_block_mode

public static boolean mcrypt_module_is_block_mode(Env env,
                                                  java.lang.String mode,
                                                  java.lang.String libDir)
Returns true for block modes


mcrypt_module_self_test

public static boolean mcrypt_module_self_test(Env env,
                                              java.lang.String algorithm,
                                              Path libDir)
Returns true for block modes


mcrypt_module_open

public static Value mcrypt_module_open(Env env,
                                       java.lang.String algorithm,
                                       Path algorithm_directory,
                                       java.lang.String mode,
                                       Path mode_directory)
Open a new mcrypt object.


mcrypt_ofb

public static StringValue mcrypt_ofb(Env env,
                                     java.lang.String cipher,
                                     byte[] key,
                                     byte[] data,
                                     int mode,
                                     byte[] iv)
Encrypt with ofb


mdecrypt_generic

public static Value mdecrypt_generic(Env env,
                                     Mcrypt mcrypt,
                                     byte[] data)
Initialize encrption