wodCrypt ActiveX Control - Encrypt Method
      
 

Description

Encrypts the contents of the Blob.


Return Type

None  


Syntax

object.Encrypt Data, OutBlob



The Encrypt Method syntax has these parts:

Part Description
object An expression evaluating to an object of type wodCrypt.
Data Required. A Blob object. Contains data to be encrypted.
OutBlob Required. A Blob object. Holds encrypted data.

Remarks

The Encrypt method will encrypt data in a given Blob and store encrypted data in the outgoing Blob. Prior to using it, you must select one of the symmetric algorithms in the Type property. Most commonly you will use the AES algorithm since it is today's standard.

wodCrypt supports optimized and standard encryption. When using wodCrypt in Optimized mode it will prepend internal data to the resulting Blob, containing data size, for example. This is needed because none of the crypto algorithms contain data sizes internally - they only encrypt memory blocks. If you want to share encrypted information to non-wodCrypt libraries, you should NOT use optimized mode. However, in this case, you should always try to provide the input Blob with the proper size (a multiple of the BlockSize property for the selected type).

Example of usage:

Dim crypt As New wodCryptCom
Dim i_blob As New MemBlob
Dim o_blob As New MemBlob
i_blob.Text = "this is text to be encrypted"
crypt.Type = AES
crypt.SecretKey = "my secret word"
crypt.Encrypt i_blob, o_blob
Debug.Print o_blob.ToBase64

result:
xHBuQv8ae1vXCVA6/3/YCd5IUjL3lbnbzHDjlWt74fGfcNuS3osQtID1BMhepJI3

When you want to decrypt data, you must use exactly the same algorithm and secret key! Different algorithms and/or different secret keys will produce completely different encryption results.