Package freenet.client.InsertContext

Examples of freenet.client.InsertContext.CompatibilityMode.ordinal()


      context.random.nextBytes(forceCryptoKey);
    }
    this.forceCryptoKey = forceCryptoKey;
   
    CompatibilityMode mode = ctx.getCompatibilityMode();
    if(!(mode == CompatibilityMode.COMPAT_CURRENT || mode.ordinal() >= CompatibilityMode.COMPAT_1416.ordinal()))
      this.cryptoAlgorithm = Key.ALGO_AES_PCFB_256_SHA256;
    else
      this.cryptoAlgorithm = Key.ALGO_AES_CTR_256_SHA256;
    runningPutHandlers = new HashSet<PutHandler>();
    putHandlersWaitingForMetadata = new HashSet<PutHandler>();
View Full Code Here


        // Don't delete them because they are being passed on.
        origHashes = null;
      }
    } else {
      CompatibilityMode cmode = ctx.getCompatibilityMode();
      boolean allowSizes = (cmode == CompatibilityMode.COMPAT_CURRENT || cmode.ordinal() >= CompatibilityMode.COMPAT_1255.ordinal());
      if(metadata) allowSizes = false;
      SplitHandler sh = new SplitHandler(origSize, compressedDataSize, allowSizes);
      SplitFileInserter sfi = new SplitFileInserter(persistent, parent, sh,
              dataRAF, shouldFreeData, ctx, context, origSize, bestCodec,
              block.clientMetadata, metadata, archiveType, cryptoAlgorithm, forceCryptoKey,
View Full Code Here

    }
   
    // We always want SHA256, even for small files.
    long wantHashes = 0;
    CompatibilityMode cmode = ctx.getCompatibilityMode();
    boolean atLeast1254 = (cmode == CompatibilityMode.COMPAT_CURRENT || cmode.ordinal() >= CompatibilityMode.COMPAT_1255.ordinal());
    if(atLeast1254) {
      // We verify this. We want it for *all* files.
      wantHashes |= HashType.SHA256.bitmask;
      // FIXME: If the user requests it, calculate the others for small files.
      // FIXME maybe the thresholds should be configurable.
View Full Code Here

        fail(ex, context);
        return;
      }
      ClientMetadata m = meta.getClientMetadata();
      CompatibilityMode cmode = ctx.getCompatibilityMode();
      if(!(cmode == CompatibilityMode.COMPAT_CURRENT || cmode.ordinal() >= CompatibilityMode.COMPAT_1255.ordinal()))
        m = null;
      if(metadataThreshold > 0 && metaBytes.length < metadataThreshold) {
        // FIXME what to do about m ???
        // I.e. do the other layers of metadata already include the content type?
        // It's probably already included in the splitfile, but need to check that, and test it.
View Full Code Here

  public boolean start(boolean restart, ClientContext context) throws InsertException {
    if(logMINOR)
      Logger.minor(this, "Starting "+this+" for "+targetURI);
    byte cryptoAlgorithm;
    CompatibilityMode mode = ctx.getCompatibilityMode();
    if(!(mode == CompatibilityMode.COMPAT_CURRENT || mode.ordinal() >= CompatibilityMode.COMPAT_1416.ordinal()))
      cryptoAlgorithm = Key.ALGO_AES_PCFB_256_SHA256;
    else
      cryptoAlgorithm = Key.ALGO_AES_CTR_256_SHA256;
    try {
      this.targetURI.checkInsertURI();
View Full Code Here

    // even if you know the content. In the user interface, we will offer the option of inserting as a
    // random SSK to take advantage of this.
    boolean randomiseSplitfileKeys = targetURI.isSSK() || targetURI.isKSK() || targetURI.isUSK();
    if(randomiseSplitfileKeys) {
      CompatibilityMode cmode = ctx.getCompatibilityMode();
      if(!(cmode == CompatibilityMode.COMPAT_CURRENT || cmode.ordinal() >= CompatibilityMode.COMPAT_1255.ordinal()))
        randomiseSplitfileKeys = false;
    }
    return randomiseSplitfileKeys;
  }
View Full Code Here

           
            boolean dontCompress = decompressors.isEmpty();
            if(topCompatibilityMode != 0) {
                // If we have top compatibility mode, then we can give a definitive answer immediately, with the splitfile key, with dontcompress, etc etc.
                if(minCompatMode == CompatibilityMode.COMPAT_UNKNOWN ||
                        !(minCompatMode.ordinal() > topCompatibilityMode || maxCompatMode.ordinal() < topCompatibilityMode)) {
                    minCompatMode = maxCompatMode = CompatibilityMode.values()[topCompatibilityMode];
                    dontCompress = topDontCompress;
                } else
                    throw new FetchException(FetchExceptionMode.INVALID_METADATA, "Top compatibility mode is incompatible with detected compatibility mode");
            }
View Full Code Here

    this.cryptoKey = cryptoKey;
  }

  protected ClientKeyBlock innerEncode(RandomSource random) throws InsertException {
    CompatibilityMode cmode = ctx.getCompatibilityMode();
    boolean pre1254 = !(cmode == CompatibilityMode.COMPAT_CURRENT || cmode.ordinal() >= CompatibilityMode.COMPAT_1255.ordinal());
    try {
      return innerEncode(random, uri, sourceData, isMetadata, compressionCodec, sourceLength, ctx.compressorDescriptor, pre1254, cryptoAlgorithm, cryptoKey);
    } catch (KeyEncodeException e) {
      Logger.error(SingleBlockInserter.class, "Caught "+e, e);
      throw new InsertException(InsertExceptionMode.INTERNAL_ERROR, e, null);
View Full Code Here

      if(data == null) {
        data = context.tempBucketFactory.makeBucket(sourceData.size());
        BucketTools.copy(sourceData, data);
      }
      CompatibilityMode cmode = ctx.getCompatibilityMode();
      boolean pre1254 = !(cmode == CompatibilityMode.COMPAT_CURRENT || cmode.ordinal() >= CompatibilityMode.COMPAT_1255.ordinal());
      return new BlockItem(key, data, isMetadata, compressionCodec, sourceLength, u, persistent, pre1254, cryptoAlgorithm, cryptoKey);
    } catch (IOException e) {
      throw new InsertException(InsertExceptionMode.BUCKET_ERROR, e, null);
    }
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.