RC2 Class
Properties Methods Events Configuration Settings Errors
Encrypt and decrypt data with the RC2 (ARC2) 64-bit block cipher.
Class Name
IPWorksEncrypt_RC2
Procedural Interface
ipworksencrypt_rc2_open(); ipworksencrypt_rc2_close($res); ipworksencrypt_rc2_register_callback($res, $id, $function); ipworksencrypt_rc2_get_last_error($res); ipworksencrypt_rc2_get_last_error_code($res); ipworksencrypt_rc2_set($res, $id, $index, $value); ipworksencrypt_rc2_get($res, $id, $index); ipworksencrypt_rc2_do_config($res, $configurationstring); ipworksencrypt_rc2_do_decrypt($res); ipworksencrypt_rc2_do_decryptblock($res, $inputbuffer, $lastblock); ipworksencrypt_rc2_do_encrypt($res); ipworksencrypt_rc2_do_encryptblock($res, $inputbuffer, $lastblock); ipworksencrypt_rc2_do_reset($res);
Remarks
The RC2 component is used to encrypt and decrypt data with the RC2 (ARC2) 64-bit block cipher.
To begin simply specify the data you wish to encrypt or decrypt.
Input and Output Properties
The class will determine the source and destination of the input and output based on which properties are set.
The order in which the input properties are checked is as follows:
When a valid source is found the search stops. The order in which the output properties are checked is as follows:- OutputFile
- OutputMessage: The output data is written to this property if no other destination is specified.
Before encrypting you must have a valid Key and IV. There are a few options available to you in regards to key management. The easiest option is to simply set KeyPassword. When KeyPassword is set the component will automatically create a Key and IV using the PKCS5 password digest algorithm. This means there is only one value you need to keep track of.
If you wish to have more control over the Key and IV values you may specify the properties yourself. If IV is left empty, one will be created for you when you call Encrypt or Decrypt.
A simple example:
Component.InputFile = "C:\MyFile.txt"; Component.OutputFile = "C:\Encrypted.txt"; Component.KeyPassword = "password"; Component.Encrypt();
Property List
The following is the full list of the properties of the class with short descriptions. Click on the links for further details.
CipherMode | The cipher mode of operation. |
InputFile | The file to process. |
InputMessage | The message to process. |
IV | The initialization vector (IV). |
Key | The secret key for the symmetric algorithm. |
KeyPassword | A password to generate the Key and IV . |
OutputFile | The output file. |
OutputMessage | The output message after processing. |
Overwrite | Indicates whether or not the component should overwrite files. |
PaddingMode | The padding mode. |
UseHex | Whether input or output is hex encoded. |
Method List
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
Config | Sets or retrieves a configuration setting . |
Decrypt | Decrypts the data. |
DecryptBlock | Decrypts a block and returns the decrypted data. |
Encrypt | Encrypts the data. |
EncryptBlock | Encrypts data and returns the encrypted block. |
Reset | Resets the component. |
Event List
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
Error | Information about errors during data delivery. |
Progress | Fired as progress is made. |
Configuration Settings
The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.
KeySize | The size, in bits, of secret key for the symmetric algorithm. |
BlockSize | The block size, in bits, of the cryptographic operation. |
IncludeIV | Whether to prepend the IV to the output data and read the IV from the input data. |
KeyPasswordAlgorithm | The hash algorithm used to derive the Key and IV from the KeyPassword property. |
KeyPasswordSalt | The salt value used in conjunction with the KeyPassword to derive the Key and IV. |
CodePage | The system code page used for Unicode to Multibyte translations. |