[p]Lasso’s built
[p]Lasso provides a set of data encryption tags which support the most commonly used encryption and hash functions used on the Internet today. These encryption tags make it possible to interoperate with other systems that require encryption and to store data in a secure fashion in data sources or files. [/p]
[p]Lasso has built
[p]Lasso’s cipher tags provide access to a wide range of industry standard encryption algorithms. The [code][Cipher_List][/code] tag lists what algorithms are available and the [code][Cipher_Encrypt][/code], [code][Cipher_Decrypt][/code], and [code][Cipher_Digest][/code] tags allow values to be encrypted or decrypted or digest values to be generated. [/p]
[p]Finally, Lasso provides a set of tags to compress or decompress data for more efficient data transmission. [/p]
[p]LassoScript provides a number of tags which allow data to be encrypted for secure storage or transmission. Three different types of encryption are supplied. [/p]
[table][tr][th]Tag[/th][th]Description[/th][th] [/th][/tr]
[tr][td][Encrypt_BlowFish2][/td][td]Encrypts a string using an industry standard BlowFish algorithm. Accepts two parameters, a string to be encrypted and a
[tr][td][Decrypt_BlowFish2][/td][td]Decrypts a string encrypted using the industry standard BlowFish algorithm. Accepts two parameters, a string to be decrypted and a
[tr][td][Encrypt_BlowFish][/td][td]Encrypts a string using the BlowFish implementation from earlier versions of Lasso. Accepts two parameters, a string to be encrypted and a
[tr][td][Decrypt_BlowFish][/td][td]Decrypts a string encrypted by the BlowFish implementation from earlier versions of Lasso. Accepts two parameters, a string to be decrypted and a
[tr][td][Encrypt_MD5][/td][td]Encrypts a string using the one
[tr][td][Encrypt_HMAC][/td][td]Generates a keyed hash message authentication code for a given input and password. The tag requires a
[/table]
[note][b]Note: [/b]The BlowFish tags are not binary safe. The output of the tag will be truncated after the first null character. It is necessary to use [code][Encode_Base64][/code] or[code] [Encode_UTF8][/code] prior to encrypting data that might contain binary characters using these tags. [/note]
[p]BlowFish requires a seed in order to encrypt or decrypt a string. The same seed which was used to encrypt data using the [code][Encrypt_BlowFish2][/code] tag must be passed to the [code][Decrypt_BlowFish2][/code] tag to decrypt that data. If you lose the key used to encrypt data then the data will be essentially unrecoverable. [/p]
[p]Seeds can be any string between 4 characters and 112 characters long. Pick the longest string possible to ensure a secure encryption. Ideal seeds contain a mix of letters, digits, and punctuation. [/p]
[p]The security considerations of storing, transmitting, and hard coding seed values is beyond the scope of this manual. In the examples that follow, we present methodologies which are easy to use, but may not provide the highest level of security possible. You should consult a security expert if security is very important for your Web site. [/p]
[note][b]Note: [/b]The BlowFish algorithm will return random results if you attempt to decrypt data which was not actually encrypted using the same algorithm. [/note]
[p]Use the [code][Encrypt_BlowFish2][/code] and [code][Decrypt_BlowFish2][/code] tags to encrypt data which will be stored in a database and then to decrypt the data when it is retrieved from the database. [/p]
[pre][Variable: 'PlainText' = 'The data to be encrypted.'] [/pre]
[pre][Variable: 'CipherText' = (Encrypt_BlowFish2: (Variable: 'PlainText'),
[pre][Inline:
'First_Name'='John',
'Last_Name'='Doe',
'CipherText'=(Variable: 'CipherText')]
[/Inline] [/pre]
[pre][Inline:
'First_Name'='John',
'Last_Name'='Doe']
[Variable: 'CipherText' = (Field: 'CipherText')]
[/Inline] [/pre]
[pre][Variable: 'PlainText' = (Decrypt_BlowFish2: (Variable: 'CipherText'),
[pre][Variable: 'PlainText'] [/pre]
[pre]
The data to be encrypted. [/pre]
[note][b]Note: [/b]This example uses the [code][Encrypt_BlowFish2][/code] and [code][Decrypt_BlowFish2][/code] tags. These are the preferred BlowFish implementation to use with Lasso. The [code][Encrypt_BlowFish][/code] and [code][Decrypt_BlowFish][/code] tags should only be used for interoperability with older versions of Lasso. [/note]
[p]The [code][Encrypt_MD5][/code] tag can be used to store a secure version of a password for a site visitor. On every subsequent visit, the password given by the visitor is encrypted using the same tag and compared to the stored value. If they match, then the visitor has supplied the same password they initially supplied. [/p]
[pre][Variable: 'SecurePassword' = (Encrypt_MD5: (Variable: 'VisitorPassword'))] [/pre]
[pre][If: (Encrypt_MD5: (Variable: 'VisitorPassword')) == (Field: 'SecurePassword')]
Log in successful.
[Else]
Password does not match.
[/If] [/pre]
[note][b]Note: [/b]For more security, most log
[p]Lasso includes a set of tags that allow access to a wide variety of encryption algorithms. These cipher tags provide implementations of many industry standard encryption methods and can be very useful when communicating using Internet protocols or communicating with legacy systems. [/p]
[p]The table below lists the [code][Cipher_…][/code] tags in Lasso. The following tables list several of the cipher algorithms and digest algorithms that can be used with the [code][Cipher_…] [/code]tags. The [code][Cipher_List][/code] tag can be used to list what algorithms are supported in a particular Lasso installation. [/p]
[note][b]Note: [/b]The actual list of supported algorithms may vary from Lasso installation to Lasso installation depending on platform and system version. The algorithms listed in this manual should be available on all systems, but other more esoteric algorithms may be available on some systems and not on others. [/note]
[table][tr][th]Tag[/th][th]Description[/th][th] [/th][/tr]
[tr][td][Cipher_Encrypt][/td][td]Encrypts a string using a specified algorithm. Requires three parameters. The data to be encrypted, a
[tr][td][Cipher_Decypt][/td][td]Decrypts a string using a specified algorithm. Requires three parameters. The data to be decrypted, a
[tr][td][Cipher_Digest][/td][td]Encrypts a string using a specified digest algorithm. Requires two parameters. The data to be encrypted and a
[tr][td][Cipher_List][/td][td]Lists the algorithms that the cipher tags support. With a
[/table]
[p]The following two tables list some of the cipher algorithms that can be used with [code][Cipher_Encrypt][/code] and some of the digest algorithms that can be used with [code][Cipher_Digest][/code]. Use [code][Cipher_List][/code] for a full list of supported algorithms. [/p]
[table][tr][th]Algorithm[/th][th]Description[/th][th] [/th][/tr]
[tr][td]AES[/td][td]Advanced Encryption Standard. A symmetric key encryption algorithm which is slated to be the replacement for DES. An implementation of the Rijndael algorithm. [/td][/tr]
[tr][td]DES[/td][td]Data Encryption Standard. A block cipher developed by IBM in 1977 and used as the government standard encryption algorithm for years. [/td][/tr]
[tr][td]3DES[/td][td]Triple DES. This algorithm uses the DES algorithm three times in succession with different keys. [/td][/tr]
[tr][td]RSA[/td][td]A public key algorithm named after Rivest, Shamir, and Adelmen. One of the most commonly used encyrption algorithsm. Note: Lasso does not generate public/private key pairs. [/td][/tr]
[/table]
[table][tr][th]Algorithm[/th][th]Description[/th][th] [/th][/tr]
[tr][td]DSA[/td][td]Digital Signature Algorithm. Part of the Digital Signature Standard. Can be used to sign messages, but not for general encryption. [/td][/tr]
[tr][td]SHA1[/td][td]Secure Hash Algorithm. Produces a 160
[tr][td]MD5[/td][td]Message Digest. A hash function that generates a 128
[/table]
[p]Use the [code][Cipher_List][/code] tag. The following tag will return a list of all the cipher algorithms supported by Lasso [/p]
[pre][Cipher_List] [/pre]
[p]With a [code]
[pre][Cipher_List:
[p]Use the [code][Cipher_Digest][/code] tag. The following tag will return the DSA signature for the value of a database field [code]Message[/code]. [/p]
[pre][Cipher_Digest: (Field: 'Message'),
[p]Use the [code][Cipher_Encrypt][/code] tag. The following tag will return the 3DES encryption for the value of a database field [code]Message[/code]. [/p]
[pre][Cipher_Encrypt: (Field: 'Message'),
[p]LassoScript provides several tags which allow Lasso’s native data types to be transformed into an XML data stream that can be stored in a database field, transmitted to a remote machine, or otherwise manipulated. The [code][Serialize][/code] and [code][Deserialize][/code] tags are equivalent to the [code][Null->Serialize][/code] and [code][Null->Deserialize][/code] tags which are documented in another chapter. [/p]
[note][b]Important: [/b]Built
[table][tr][th]Tag[/th][th]Description[/th][th] [/th][/tr]
[tr][td][Serialize][/td][td]Accepts a single parameter. Converts the parameter to a byte stream representation. The returned string can be stored in a database. [/td][/tr]
[tr][td][Deserialize][/td][td]Accepts a single parameter which is a byte stream that represents a Lasso value. Returns the value represented by the parameter. [/td][/tr]
[/table]
[p]Use the [code][Serialize][/code] to transform the data type into a byte stream string representation that can be stored in a database field. Then use [code][Deserialize][/code] to transform the byte stream string representation back into the original data type. The following example shows how to convert an array into a string and then back again. [/p]
[pre][Variable: 'ArrayVariable'=(Array: 'one', 'two', 'three', 'four', 'five')] [/pre]
[pre][Variable: 'TempVariable'=(Serialize: $ArrayVariable)] [/pre]
[pre][Variable: 'ArrayVariable'=(Deserialize: $TempVariable)] [/pre]
[pre][Variable: 'ArrayVariable'] [/pre]
[pre]
(Array: (one), (two), (three), (four), (five)) [/pre]
[p]LassoScript provides two tags which allow data to be stored or transmitted more efficiently. The [code][Compress][/code] tag can be used to compress any text string into an efficient byte stream that can be stored in a text field in a database or transmitted to another server. The [code][Decompress][/code] tag can then be used to restore a compressed byte stream into the original string. [/p]
[p]The compression algorithm should only be used on large string values. For strings of less than one hundred characters the algorithm may actually result in a larger string than the source. [/p]
[p]These tags can be used in concert with the [code][Null->Serialize][/code] tag that creates a string representation of any data type in LassoScript and the [code][Null->Deserialize][/code] tag that returns the original value based on a string representation. An example below shows how to compress and decompress an array variable. [/p]
[table][tr][th]Tag[/th][th]Description[/th][th] [/th][/tr]
[tr][td][Compress][/td][td]Compresses a string parameter. [/td][/tr]
[tr][td][Decompress][/td][td]Decompresses a byte stream. [/td][/tr]
[/table]
[pre][Variable: 'InputVariable'='This is the string to be compressed.']
[Variable: 'CompressedVariable'=(Compress: $InputVariable)] [/pre]
[pre][Variable: 'OutputVariable'=(Decompress: $CompressedVariable)]
[Variable: 'OutputVariable'] [/pre]
[pre]
This is the string to be compressed. [/pre]
[pre][Variable: 'ArrayVariable'=(Array: 'one', 'two', 'three', 'four', 'five')] [/pre]
[pre][Variable: 'InputVariable'=(Serialize: $ArrayVariable)] [/pre]
[pre][Variable: 'CompressedVariable'=(Compress: $InputVariable)] [/pre]
[pre][Variable: 'OutputVariable'=(Decompress: $CompressedVariable)] [/pre]
[pre][Variable: 'ArrayVariable'=(Deserialize: $OutputVariable)] [/pre]
[pre][Variable: 'ArrayVariable'] [/pre]
[pre]
(Array: (one), (two), (three), (four), (five)) [/pre]