When you upload files to Edge Drive or <ObjectStore> using APIs, you can check the file integrity of the uploaded content using Secure Hash Algorithm (SHA) - 256 cryptographic hash function.
Commvault supports two types of file integrity checks: Full File Integrity check and Block level integrity check.
Full File Integrity Check
In a full file integrity check, you will compute the SHA-256 hash of the complete file, and then upload the hash value in hexadecimal format to the FullFileHash header. If the hash value is identical to the hash value generated by the API, the upload operation completes successfully.
Full file integrity check can be used with full file upload and chunk file upload APIs. For chunk file uploads, pass the FullFileHash header in the last chunk.
The API returns an optional fileIntegrityVerified
parameter in the response, to indicate if the file integrity check was verified. Value 1 indicates that the hash value is identical and the file integrity check is verified.
Block Level Integrity Check
When you upload large files, computing the full file hash takes a long time and slows the upload operation. In such cases, use a block level integrity check with the chunk upload API.
To enable block level integrity check, add the verifyBlockLevelFileIntegrity
request parameter to the chunk upload URI, with value True.
To compute the block level hash of a file, complete the following steps:
-
Divide the large file into chunks of 4 MB. The last chunk can be smaller or equal to 4 MB.
-
Compute the SHA-256 hash of each chunk.
-
Concatenate the binary format of each chunk hash to form a single binary string.
-
Compute the SHA-256 hash of the concatenated string.
-
Upload the resulting hash value in hexadecimal format to the BlockLevelHash header of the last chunk.
If the block level hash value of the concatenated chunk hash string is identical with the hash value generated by the chunk upload API, the upload operations completes successfully.
The API returns an optional fileIntegrityVerified
parameter in the response, to indicate if the hash value was verified. Value 1 indicates that the hash value is identical and the file integrity check is verified.