Package org.hive2hive.core.security

Examples of org.hive2hive.core.security.HybridEncryptedContent


    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);
View Full Code Here


      logger.warn("Meta file not found.");
      throw new ProcessExecutionException("Meta file not found.");
    } else {

      // decrypt meta document
      HybridEncryptedContent encryptedContent = (HybridEncryptedContent) loadedContent;

      NetworkContent decryptedContent = null;
      try {
        decryptedContent = H2HEncryptionUtil.decryptHybrid(encryptedContent, keyPair.getPrivate());
      } catch (InvalidKeyException | DataLengthException | IllegalBlockSizeException
View Full Code Here

    if (content == null) {
      task.abortDownload("Chunk not found in the DHT");
      return;
    }

    HybridEncryptedContent encrypted = (HybridEncryptedContent) content;
    Chunk chunk;

    try {
      NetworkContent decrypted = H2HEncryptionUtil.decryptHybrid(encrypted, task.getDecryptionKey());
      chunk = (Chunk) decrypted;
View Full Code Here

TOP

Related Classes of org.hive2hive.core.security.HybridEncryptedContent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.