VB example Delphi example VC++ example C# example VB.NET example
You can freely replace the word "encrypt" with "decrypt" to find out how to decrypt data because encrypting and decrypting work exactly the same way.
To encrypt data with Rijndael or Twofish entirely in memory, from one memory buffer to another in a single pass, perform the following 5 steps. Put the Xceed Encryption control on a form or instantiate it, then:
Specify the encryption method to use. To do this, create an instance of the XceedRijndaelEncryptionMethod object or the XceedTwofishEncryptionMethod object and assign it to the EncryptionMethod property.
Specify the Secret Key to use. To do this from a PassPhrase , use the SetSecretKeyFromPassPhrase method that belongs to the Encryption Method object you assigned to the EncryptionMethod property.
Tell the library to encrypt. To do this, call the Encrypt method, passing your source memory buffer and specifying True for the bEndOfData parameter.
Obtain the encrypted data. To do this, assign the return value of the Encrypt method to the variable of your choice.
Make sure that everything worked properly. To do this, use your language's error handling object or error handling capabilities. The Xceed Encryption Library supports standard COM error handling functionality.
To encrypt data with RSA entirely in memory, from one memory buffer to another in a single pass, perform the following 5 steps. Put the Xceed Encryption control on a form or instantiate it, then:
Specify the encryption method to use. To do this, create an instance of the XceedRSAEncryptionMethod object and assign it to the EncryptionMethod property.
If you are encrypting, specify the Public Key to use. To do this, set the PublicKey property that belongs to the XceedRSAEncryptionMethod object you assigned to the EncryptionMethod property. If you are decrypting, specify the Private Key to use. To do this, set the PrivateKey property instead. If you need to create an RSA-compatible Public Key and Private Key pair to use, then call the SetRandomKeyPair method and retrieve the keys from the PublicKey and PrivateKey properties.
Tell the library to encrypt. To do this, call the Encrypt method, passing your source memory buffer and specifying True for the bEndOfData parameter.
Obtain the encrypted data. To do this, assign the return value of the Encrypt method to the variable of your choice.
Make sure that everything worked properly. To do this, use your language's error handling object or error handling capabilities. The Xceed Encryption Library supports standard COM error handling functionality.
To encrypt data using Rijndael or Twofish entirely in memory while providing the library with data to encrypt as it becomes available, perform the following 6 steps. Put the Xceed Encryption Control on a form or instantiate it, then:
Specify the encryption method to use. To do this, create an instance of the XceedRijndaelEncryptionMethod object or the XceedTwofishEncryptionMethod object and assign it to the EncryptionMethod property.
Specify the Secret Key to use. To do this from a PassPhrase , use the SetSecretKeyFromPassPhrase method that belongs to the Encryption Method object you assigned to the EncryptionMethod property.
Provide data to the library as it becomes available. To do this, call the Encrypt method for each portion of data, passing it a memory buffer with the portion of the data and specifying False for the bEndOfData parameter.
Accumulate the encrypted data. To do this, append the data returned by the Encrypt method to a variable which contains the complete encrypted memory buffer so far. You can also process the encrypted data as it is returned by the library or pass it to other streaming methods.
Continue providing data to encrypt until you're done. When there is no more data to encrypt, call the Encrypt method with a final (or empty) block of data to encrypt and specify True for the bEndOfData parameter. Be sure to assign the Encrypt method's final returned encrypted data to your accumulation variable or process it or pass it to other streaming methods.
Make sure that everything worked properly. To do this, use your language's error handling object or error handling capabilities. The Xceed Encryption Library supports standard COM error handling functionality.