Package freenet.keys

Examples of freenet.keys.ClientCHK


    private ClientCHK innerReadKey(DataInputStream dis) throws IOException {
        if(splitfileCryptoKey != null) {
            byte[] routingKey = new byte[32];
            dis.readFully(routingKey);
            return new ClientCHK(routingKey, splitfileCryptoKey, false, splitfileCryptoAlgorithm,
                    (short)-1);
        } else {
            return new ClientCHK(dis);
        }
    }
View Full Code Here


        if(parent.checker.checkChecksum(checkBuf, 0, checkBuf.length, checksum))
            throw new MissingKeyException();
        DataInputStream dis = new DataInputStream(new ByteArrayInputStream(buf));
        byte b = dis.readByte();
        if(b != 1) throw new MissingKeyException();
        ClientCHK key = innerReadKey(dis);
        setHasKey(blockNumber);
        if(logDEBUG) Logger.debug(this, "Returning "+key);
        return key;
    }
View Full Code Here

    } else {
      int offset = x * EXTRA_BYTES_LENGTH;
      extra = Arrays.copyOfRange(extraBytesForKeys, offset, offset + EXTRA_BYTES_LENGTH);
    }
    try {
      return new ClientCHK(routingKey, decryptKey, extra);
    } catch (MalformedURLException e) {
      Logger.error(this, "Impossible: "+e);
      throw new IllegalStateException(e);
    }
  }
View Full Code Here

    } else {
      int rkOffset = offset * NodeCHK.KEY_LENGTH;
      int extraOffset = offset * EXTRA_BYTES_LENGTH;
      assert(NodeCHK.KEY_LENGTH == ClientCHK.CRYPTO_KEY_LENGTH);
      for(int i=0;i<count;i++) {
        ClientCHK key = ClientCHK.readRawBinaryKey(dis);
        byte[] r = key.getRoutingKey();
        System.arraycopy(r, 0, routingKeys, rkOffset, NodeCHK.KEY_LENGTH);
        byte[] c = key.getCryptoKey();
        System.arraycopy(c, 0, decryptKeys, rkOffset, NodeCHK.KEY_LENGTH);
        rkOffset += NodeCHK.KEY_LENGTH;
        byte[] e = key.getExtra();
        System.arraycopy(e, 0, extraBytesForKeys, extraOffset, EXTRA_BYTES_LENGTH);
        extraOffset += EXTRA_BYTES_LENGTH;
      }
    }
  }
View Full Code Here

    private void writeCheckBlock(int checkBlockNo, byte[] buf) throws IOException {
        parent.writeCheckBlock(segNo, checkBlockNo, buf);
        if(DEBUG_ENCODE) {
            SplitFileInserterSegmentStorage segment = segments[checkBlockNo + dataBlockCount];
            ClientCHK key = segment.encodeBlock(buf).getClientKey();
            segment.setKey(blockNumbers[checkBlockNo + dataBlockCount], key);
        }
    }
View Full Code Here

        try {
            byte[][] data = new byte[dataBlockCount][];
            for(int i=0;i<dataBlockCount;i++) {
                data[i] = segments[i].readDataBlock(blockNumbers[i]);
                if(DEBUG_ENCODE) {
                    ClientCHK key = segments[i].encodeBlock(data[i]).getClientKey();
                    segments[i].setKey(blockNumbers[i], key);
                }
            }
            return data;
        } finally {
View Full Code Here

TOP

Related Classes of freenet.keys.ClientCHK

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.