|
|
CapeSoft CryptoNite Class Reference |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Using the CryptoNite Class In general a CryptoNite object is declared as simply as st CryptoNite Where st is the label name (and can be almost anything.) The length of the string is undefined, and is dynamic. In other words the string will automatically grow, and shrink as required. You do not need to worry about the length. Values are assigned into the string using the SetValue method, or by loading a file off the disk using the LoadFile method. st.SetValue('hello world') st.LoadFile('c:\windows\win.ini') After that the string can be manipulated in a number of different ways, using the methods described below. For example to Base64 encode the string; st.Base64Encode()
Blowfish Encryption and Decryption Methods The CryptoNite class supports BlowFish encryption and decryption of strings and files. This uses the csBlowFish class that is a part of CryptoNite.
Encryption and Decryption Examples An example of encrypting and Base64 encoding a string using the CryptoNite object. s
CryptoNite See the methods below for additional
examples. InitBlowfish Procedure (string key) Initialises the Blowfish object. This must be called before any of the other Blowfish methods are used. Parameters key The key to use for encryption. This string contains a binary value and can be up to 56 bytes (characters) long (448bit). Typically you should provide a string that is exactly 56 bytes in length. Return Value Returns True (1) if succesful and False (0) if encryption fails. Example s
CryptoNite
Cleans up and deallocates memory. Will be called automatically when the CryptoNite object is destroyed.
Encrypts the current value stored in the CryptoNite object. See Important Notes for more information.
Return Value Returns True (1) if succesful and False (0) if encryption fails.
Decrypts the current value stored in the CryptoNite object. See Important Notes for more information.
Return Value Returns True (1) if succesful and False (0) if encryption fails.
bfEncryptString Procedure (*string plainText, *string cipherText) Encrypts the passed plainText string and stores the encrypted data in the passed cipherText string. See Important Notes for more information. The cipherText string should be at least the same length as the plainText string in order to store the encrypted data. Parameters plainText A string to store the decrypted data that results from decrypting the passed cipherText. cipherText The data to decrypt
Return Value Returns True (1) if succesful and False (0) if encryption fails. Example s
CryptoNite
bfDecryptString Procedure (*string plainText, *string cipherText) Decrypts the passed cipherText string and stores the decrypted data in the passed plainText string. See Important Notes for more information. The plainText string should be at least the same length as the chipherText string in order to hold the data. Parameters plainText A string to store the decrypted data that results from decrypting the passed cipherText. cipherText The data to decrypt Return Value Returns True (1) if succesful and False (0) if encryption fails.
Example s
CryptoNite
bfSetKey Procedure (string key) Sets the key stored by the object for encryption. The key is initially set when the InitBlowfish method is called, however this can be used to change the key being used after the object has been initialised. Parameters key The key to use for encryption. This string contains a binary value and can be up to 56 bytes (characters) long (448bit). Typically you should provide a string that is exactly 56 bytes in length.
CryptoNite Property Reference
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|