Omnis Externals
Crypto Documentation
A cryptography external for use with Omnis Studio
Outline of Crypto Library v0.1
The "Crypto" external library provides users with a set of invisible external Omnis objects, which encapsulate encryption and decryption by a set of recognised algorithms. Users are able to encrypt/decrypt data passed to "Crypto" external objects by one of two paths:
It is anticipated that the string interface will prove useful when processing small amounts of dynamically generated content, whilst the file methods will prove useful in handling larger amounts of sensitive data.
Static Methods
The library presents a set of static external methods which are intended to provide general information concerning this product.
- character[] $versionInfo(): returns a character array containing the control string: " crypto version: MAJOR_VERSION_NUMBER . MINOR_VERSION_NUMBER ".
- boolean $demoExpired(): The evaluation version of this product is time limited and will expire. This function will return TRUE if the external has expired and false otherwise. Expired externals will not provide cryptography function.
- character[]$demoExpiryInfo(): returns a character array containing the date at which the external is due to expire.
Please note that a full registered version of this external will not expire and that these methods will remain available even after the expiry date of the time-limited demo.
Cryptography Objects
This section will describe the interface presented by the cryptography classes.
cryptoDES
A class implementing the single DES encryption scheme. Note that encrypted output from DES will always be an exact multiple of 8 characters, i.e. not necessarily the same length as that data supplied.
- boolean $setKey( character[] ): single DES relies upon the definition of an eight character key, which is supplied using this method. The method returns TRUE if the key is accepted and FALSE otherwise. Keys that are not of acceptable length will be rejected leading to a FALSE return value.
- character[] $getKey() : returns the key that is presently set for this object. Returns an empty if string if no key is set.
- boolean $isKeySet(): returns TRUE is a key is set for this object and FALSE otherwise.
- character[] $encrypt( character[] ): encrypts a supplied character array and returns the result. This method can fail, returning an array of zero length. Reasons for failure are:
- DES key is not specified.
- Input data is of zero length.
- Insufficient memory to perform the operation.
- character[] $decrypt( character[] ): decrypts a string that has been DES encrypted using the same key as that held by the object. This method can fail, returning an array of zero length. Reasons for failiure are:
- DES key is not specified.
- The character array is not an exact multiple of eight characters, i.e. an invalid string.
- Insufficient memory to perform the operation.
- boolean $encryptFile( character[] Source, character[] Destination ): encrypts a file at the source location specified and places the encrypted data in a file at the destination location specified. This method returns TRUE if the operation was successful and false otherwise. Possible reasons for failure include:
- DES key is not specified.
- Source file does not exist.
- Destination file cannot be created.
- Insufficient memory to perform the operation.
- boolean $decryptFile( character[] Source, character[] Destination ): decrypts a file at the source location specified and places the encrypted data in a file at the destination location specified. Possible reasons for failiure include:
- DES key is not specified.
- Source file does not exist.
- The file length is not an exact multiple of eight bytes, i.e. an invalid file.
- Insufficient memory to perform the operation.
crypto3DES
- The stronger variant of single DES encryption. This scheme must be supplied with a key of sixteen or twenty-four characters length. The crypto3DES class provides an identical interface to the cryptoDES class. Methods are as follows and when uncommented, one can assume the requirements and restrictions for this class are identical to that of cryptoDES:
- boolean $setKey( character[] ): accepts a key of length sixteen or twenty-four characters. Returns TRUE for acceptable keys and FALSE otherwise.
character[] $getKey()
boolean $isKeyValid()
character[] $encrypt( character[] )
character[] $decrypt( character[] )
boolean $encryptFile( character[] Source, character[] Destination )
boolean $decryptFile()
|