CryptoBlob Object

Overview

The CryptoBlob object is an auxiliary object for storing, exporting, importing and formatting binary data.

Member List

Properties


Ansi As String (Read/Write)

Sets and returns binary data via an ASCII string.

This property is to be used when binary data (such as a symmetric encryption key) is specified as an ASCII string. For example, a DES key can be specified as "ABCDEF" which translates to binary data 0x41 0x42 0x43 0x44 0x45 0x46. If the specified value is not in ASCII format, it will be converted to a UTF-8 sequence of bytes.

This property was added in Version 2.4.


Base64 As String (Read/Write)

Sets and returns binary data in the Base64-encoded form.


Binary As Variant (Read/Write)

Sets and returns binary data as a Variant-wrapped safe array of bytes. This format is useful for saving and loading binary data to and from the database as it is compatible with the ADO representation of blobs. It can also be used for such methods as ASP's Response.BinaryWrite.


Hex As String (Read/Write)

Sets and returns binary data in the form of a string of Hex characters.


Length As Integer (Read/Write)

Returns the length in bytes of the blob content. This property was introduced in version 2.6.

Methods


Sub Append(Blob As CryptoBlob)

Appends the content of Blob to this CryptoBlob object. This method was introduced in version 2.6.

Usage:

Blob.Append AnotherBlob

Sub DumpToFile(Path As String)

Saves the underlying blob to a file specified by Path.

Usage:

Blob.DumpToFile "c:\myfile.xxx"

Sub DumpToRegistry(Hive As Long, Key As String, Value As String)

Saves the underlying blob to a registry key.

Hive must be set to one of the following values: &H80000000 (HKEY_CLASSES_ROOT), &H80000005 (HKEY_CURRENT_CONFIG), &H80000001 (HKEY_CURRENT_USER), &H80000002 (HKEY_LOCAL_MACHINE) or &H80000003 (HKEY_USERS).

Key and Value specify the registry key and value to be used. If the specified key and/or value does not exist it will be created. If Value is set to an empty string, the default value of the key will be used.

Usage:

Blob.DumpToRegistry &H80000001, "Software\ACME\My Product", "test"

Sub LoadFromFile(Path As String)

Populates the blob object with binary data from a file specified by Path.

Usage:

Blob.LoadFromFile "c:\myfile.xxx"

Sub LoadFromRegistry(Hive As Long, Key As String, Value As String)

Populates the blob object from a binary value of a registry key.

See the method DumpToRegistry for the description of the arguments.

Usage:

Blob.LoadFromRegistry &H80000001, "Software\ACME\My Product", "test

Sub Reverse()

Reverses the bytes in the blob object. This may be useful when working with external symmetric keys.

This method was added in Version 2.4.

Usage:

Blob.Reverse
CryptoName XEncrypt