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 from memory to file in a single pass, perform the following 4 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 WriteFile method, passing your source memory buffer and specifying the destination filename as well as True for the bEndOfData parameter.
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 from memory to file in a single pass, perform the following 4 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 WriteFile method, passing your source memory buffer and specifying the destination filename as well as True for the bEndOfData parameter.
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 from memory to file in a streaming fashion, 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.
Provide data to the library as it becomes available. To do this, call the WriteFile method for each portion of data, passing it a memory buffer with the portion of the data and specifying the destination filename and False for the bEndOfData parameter.
Continue providing data to encrypt until you're done. When there is no more data to encrypt, call the WriteFile method with a final (or empty) block of data to encrypt and specify True for the bEndOfData parameter.
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.