Reprotect Data
Overview
This API reprotects the data with the latest version of the protection policy. It returns the CipherTextData
array which contains the updated CipherTextData
objects holding the reprotected data. If the reprotect operation fails at any CipherTextData
, the corresponding error message is assigned to the CipherTextData
instance. The error message can be fetched using the CipherTextData.getErrorMessage()
method.
Prerequisites
CipherTrust Manager must be up and running. Refer to CipherTrust Manager Deployment for details.
CADP for Java must be up and running and the client must be registered. Refer to the Quick Start section for details.
Protection policy must be created. Refer to Creating Protection Policy for details.
Request Parameters
Parameter | Description |
---|---|
protectionPolicyName | Protection policy to be used during the reprotect operation. |
cipherTextDataArray | CipherTextData[] which contains the protected data encrypted with older version of protection policy. |
The following code snippet shows how to reprotect data:
cipherTextDataObject = CryptoManager.reprotect(cipherTextDataObject, protectionPolicyName);
Structure of CipherTextData object
CipherTextData {
private byte[] cipherText;
private byte[] version //only applicable when external versioned protection policy is used. In case of internal versioned protection policy, the version header is prepended to the cipherText.//
private String errorMessage;//only applicable for reprotect API.
private byte[] nonce; //only applicable when external protection policy is used. In case of internal versioned protection policy, the nonce is prepended to the cipherText.//
}
API Response
To get the reprotected data, use the below code snippet.
for (int i = 0; i < cipherTextDataObject.length; i++) {
if (cipherTextDataObject[i].getErrorMessage() != null) {
System.out
.println("Error Message for item " + i + " : " + cipherTextDataObject[i].getErrorMessage());
} else {
System.out.println("Re protected data for item " + i + " : "
+ new String(cipherTextDataObject[i].getCipherText()));
}
}
Response Parameter
The reprotect API returns the CipherTextData
array.
Parameter | Description |
---|---|
cipherTextDataObject | Contains the updated CipherTextData objects that holds the reprotected data. |
Reference
The compiled sample for reprotect is available on Github.