The Decrypt method decrypts data entirely in memory. It can decrypt data in a single call, or it can be called multiple times to decrypt data in a streaming fashion.
Parameter | Description |
---|---|
vaEncrypted | The data to decrypt. The variant can contain a string or a byte array. |
bEndOfData | This parameter indicates to the library whether or not there is more data to decrypt. If you only have a single block of data to decrypt, set this parameter to True. The library will then immediately decrypt all the data provided in the vaSourceparameter and return the resulting decrypted data. If you can (or want to) only provide a portion of the data to decrypt in the vaSourceparameter and will provide more data later in a subsequent call to the Decrypt method, set this parameter to False. In this case, the library will decrypt and return as much data as possible. When the final portion of the data to decrypt has been provided, set the bEndOfData parameter to True. The method will then return the final portion of the decrypted data. |
The return value is a byte array variant containing the decrypted data.
These properties can be found in the various Encryption Method objects.
EncryptionMethod, EncryptionMode, InitVector, PaddingMethod, SecretKey, PrivateKey
ToString and FromString
For secret-key encryption the SecretKey property must be initialized and, if the EncryptionMode property is set to emoChainedBlocks, the stream or data to decrypt must begin with an unencrypted initialization vector as produced by the Xceed Encryption Library in emoChainedBlocks mode.
For public-key encryption , the PrivateKey property must be initialized and must have a strength of at least 338 bits.
When calling the Decrypt method with the bEndOfData parameter specified as False, you cannot call any other Xceed Encryption control method (of the same instance of the control) until you have completed processing a stream of data by calling the Decrypt method with the bEndOfData parameter specified as True, or an error occurs, or the Reset method is called.
With Visual Basic, it is often necessary to convert the resulting decrypted data from a byte array variant to a native VB byte array before saving it or transmitting it. VB6 makes it particularly easy to do the conversion: If you have a variant named (for example) DecryptedData, you can convert it to a native VB byte array with the following code:
Visual Basic | Copy Code |
---|---|
|
With Microsoft Access, you can place the decrypted data in either a Memo field or an OLE Object field. Using an OLE Object field in a table is the easiest: You can directly assign your data to the field and conversion is automatic. To assign the decrypted data variant to a Memo field, use the "AppendChunk" function in Access.
Declaration (DXceedEncryption) | Copy Code |
---|---|
HRESULT Decrypt( [in] VARIANT* vaEncrypted, [in] VARIANT_BOOL bEndOfData, |
Declaration (IXceedEncryption) | Copy Code |
---|---|
|