*/
public void put(PutQueueEntry entry) {
logger.debug("Put user profile. user id = '{}'", credentials.getUserId());
try {
logger.trace("Encrypting user profile with 256bit AES key from password. user id ='{}'", credentials.getUserId());
EncryptedNetworkContent encryptedUserProfile = H2HEncryptionUtil.encryptAES(entry.getUserProfile(),
userProfileEncryptionKey);
encryptedUserProfile.setBasedOnKey(entry.getUserProfile().getVersionKey());
encryptedUserProfile.generateVersionKey();
IParameters parameters = new Parameters().setLocationKey(credentials.getProfileLocationKey())
.setContentKey(H2HConstants.USER_PROFILE).setVersionKey(encryptedUserProfile.getVersionKey())
.setData(encryptedUserProfile).setProtectionKeys(entry.getUserProfile().getProtectionKeys())
.setTTL(entry.getUserProfile().getTimeToLive());
boolean success = dataManager.put(parameters);
if (!success) {
entry.setPutError(new PutFailedException("Put failed."));
} else {
// cache user profile
cachedUserProfile = entry.getUserProfile();
cachedUserProfile.setBasedOnKey(encryptedUserProfile.getBasedOnKey());
cachedUserProfile.setVersionKey(encryptedUserProfile.getVersionKey());
}
} catch (DataLengthException | IllegalStateException | InvalidCipherTextException | IOException e) {
logger.error("Cannot encrypt the user profile. reason = '{}'", e.getMessage());
entry.setPutError(new PutFailedException(String.format("Cannot encrypt the user profile. reason = '%s'",
e.getMessage())));