CArclib::ArcGenerateAESKeyBuffer

The ArcGenerateAESKeyBuffer method creates AES Key for the volumeset(s) with encryption capability.

 

virtual ARC_STATUS ArcGenerateAESKeyBuffer (

BYTE nVolNumber,

BYTE nVolArray[],

DWORD *nKeyBufSize,

BYTE *pKeyBuf

);

Parameters:

[IN]

nVolNumber: Indicate how many volumes in the nVolarray.

This value set to 0 indicates to use all volumes to generate AES key and ignore the content of nVolarray.

nVolArray: Pointer to an array containing index of volumes with encryption capability would be used to generate AES key.

[OUT]

nKeyBufSize: [IN] The buffer size of pKeyBuf. [OUT] The data length in pKeyBuf.

pKeyBuf: Pointer to a buffer containing AES key

Return Values

This method returns the ARC_STATUS.

Examples:

Example1: generate AES key for volume0 and volume1, these two volumes must have encryption capability.

/* pseudo code to generate AES key buffer */

BYTE volNumber = 2; // there are two elements in the volArray

BYTE volArray[] = {0, 1}; // two volumes would be used to generate AES key.

status = ArcGenerateAESKeyBuffer(2, volArray, bufsize, buf);

 

Example2: generate AES key for all volumes, these volumes must have encryption capability.

/* pseudo code to generate AES key buffer */

status = ArcGenerateAESKeyBuffer(0, NULL, bufsize, buf);

 

However, the simplest and similar way to the CLI "vsf genkey" command is to use ArcGenerateAESKeyBuffer(0, NULL, bufsize, buf) to

generate AES key and save the "buf" into a file.

Note:

Volume would not be used to generate AES key if the AES key already assigned to it.

Password required if password enabled, use ArcChkPassword member function to validate the password.