try {
MetaFile metaFile = context.consumeMetaFile();
KeyPair protectionKeys = context.consumeProtectionKeys();
logger.trace("Encrypting meta file of file '{}' in a hybrid manner.", context.getFile().getName());
HybridEncryptedContent encrypted = H2HEncryptionUtil.encryptHybrid(metaFile, metaFile.getId());
encrypted.setBasedOnKey(metaFile.getVersionKey());
encrypted.generateVersionKey();
Parameters parameters = new Parameters()
.setLocationKey(H2HEncryptionUtil.key2String(metaFile.getId()))
.setContentKey(H2HConstants.META_FILE).setVersionKey(encrypted.getVersionKey())
.setData(encrypted).setProtectionKeys(protectionKeys).setTTL(metaFile.getTimeToLive());
// data manager has to produce the hash, which gets used for signing
parameters.setHashFlag(true);
// put the encrypted meta file into the network
put(parameters);