Package freenet.keys

Examples of freenet.keys.NodeSSK


      } else
        try {
          node.storeInsert(block, deep, false, canWriteClientCache, false);
        } catch(KeyCollisionException e) {
          LowLevelPutException failed = new LowLevelPutException(LowLevelPutException.COLLISION);
          NodeSSK key = block.getKey();
          KeyBlock collided = node.fetch(key, true, canWriteClientCache, false, false, null);
          if(collided == null) {
            Logger.error(this, "Collided but no key?!");
            // Could be a race condition.
            try {
View Full Code Here


    KeyBlock kb = null;

    if (key instanceof NodeCHK) {
      kb = fetch(key, false, canReadClientCache, canWriteClientCache, canWriteDatastore, null);
    } else if (key instanceof NodeSSK) {
      NodeSSK sskKey = (NodeSSK) key;
      DSAPublicKey pubKey = sskKey.getPubKey();
      if (pubKey == null) {
        pubKey = getPubKey.getKey(sskKey.getPubKeyHash(), canReadClientCache, offersOnly, null);
        if (logMINOR)
          Logger.minor(this, "Fetched pubkey: " + pubKey);
        try {
          sskKey.setPubKey(pubKey);
        } catch (SSKVerifyException e) {
          Logger.error(this, "Error setting pubkey: " + e, e);
        }
      }
      if (pubKey != null) {
View Full Code Here

   * @param ignoreLowBackoff
   * @param preferInsert
   */
  public SSKInsertSender makeInsertSender(SSKBlock block, short htl, long uid, InsertTag tag, PeerNode source,
      boolean fromStore, boolean canWriteClientCache, boolean canWriteDatastore, boolean forkOnCacheable, boolean preferInsert, boolean ignoreLowBackoff, boolean realTimeFlag) {
    NodeSSK key = block.getKey();
    if(key.getPubKey() == null) {
      throw new IllegalArgumentException("No pub key when inserting");
    }

    getPubKey.cacheKey(key.getPubKeyHash(), key.getPubKey(), false, canWriteClientCache, canWriteDatastore, false, writeLocalToDatastore);
    Logger.minor(this, "makeInsertSender("+key+ ',' +htl+ ',' +uid+ ',' +source+",...,"+fromStore);
    SSKInsertSender is = null;
    is = new SSKInsertSender(block, uid, tag, htl, source, this, fromStore, canWriteClientCache, forkOnCacheable, preferInsert, ignoreLowBackoff, realTimeFlag);
    is.start();
    return is;
View Full Code Here

      String test = "test" + i;
      ClientSSKBlock block = encodeBlockSSK(test, random);
      SSKBlock sskBlock = (SSKBlock) block.getBlock();
      store.put(sskBlock, false, false);
      ClientSSK key = block.getClientKey();
      NodeSSK ssk = (NodeSSK) key.getNodeKey();
      pubkeyCache.cacheKey(ssk.getPubKeyHash(), ssk.getPubKey(), false, false, false, false, false);
      SSKBlock verify = store.fetch(ssk, false, false, false, false, null);
      String data = decodeBlockSSK(verify, key);
      assertEquals(test, data);
    }
   
View Full Code Here

    }
   
    ClientSSK key = block1.getClientKey();
    pubkeyCache.cacheKey(sskBlock.getKey().getPubKeyHash(), sskBlock.getKey().getPubKey(), false, false, false, false, false);
    // Check that it's in the cache, *not* the underlying store.
    NodeSSK ssk = (NodeSSK) key.getNodeKey();
    SSKBlock verify = store.fetch(ssk, false, false, false, false, null);
    String data = decodeBlockSSK(verify, key);
    assertEquals(test1, data);
   
    saltStore.close();
View Full Code Here

      String test = "test" + i;
      ClientSSKBlock block = encodeBlockSSK(test, random);
      SSKBlock sskBlock = (SSKBlock) block.getBlock();
      store.put(sskBlock, false, false);
      ClientSSK key = block.getClientKey();
      NodeSSK ssk = (NodeSSK) key.getNodeKey();
      pubkeyCache.cacheKey(ssk.getPubKeyHash(), ssk.getPubKey(), false, false, false, false, false);
      // Check that it's in the cache, *not* the underlying store.
      assertEquals(saltStore.fetch(ssk.getRoutingKey(), ssk.getFullKey(), false, false, false, false, null), null);
      SSKBlock verify = store.fetch(ssk, false, false, false, false, null);
      String data = decodeBlockSSK(verify, key);
      assertEquals(test, data);
    }
   
View Full Code Here

    for(int i=0;i<5;i++) {
      String test = tests.remove(0); //get the first element
      ClientSSKBlock block = sskBlocks.remove(0); //get the first element
      ClientSSK key = block.getClientKey();
      NodeSSK ssk = (NodeSSK) key.getNodeKey();
      SSKBlock verify = store.fetch(ssk, false, false, false, false, null);
      String data = decodeBlockSSK(verify, key);
      assertEquals(test, data);
    }
   
View Full Code Here

   
    for(int i=0;i<5;i++) {
      String test = tests.remove(0); //get the first element
      ClientSSKBlock block = sskBlocks.remove(0); //get the first element
      ClientSSK key = block.getClientKey();
      NodeSSK ssk = (NodeSSK) key.getNodeKey();
      SSKBlock verify = store.fetch(ssk, false, false, false, false, null);
      String data = decodeBlockSSK(verify, key);
      assertEquals(test, data);
    }
   
View Full Code Here

    }
   
    ClientSSK key = block1.getClientKey();
    pubkeyCache.cacheKey(sskBlock.getKey().getPubKeyHash(), sskBlock.getKey().getPubKey(), false, false, false, false, false);
    // Check that it's in the cache, *not* the underlying store.
    NodeSSK ssk = (NodeSSK) key.getNodeKey();
    SSKBlock verify = store.fetch(ssk, false, false, false, false, null);
    String data = decodeBlockSSK(verify, key);
    assertEquals(test1, data);
   
    if(useSlotFilter) {
View Full Code Here

      tag.unlockHandler(rejectReason.soft);
      return;
    }
    long now = System.currentTimeMillis();
    if(m.getSpec().equals(DMT.FNPSSKInsertRequest)) {
      NodeSSK key = (NodeSSK) m.getObject(DMT.FREENET_ROUTING_KEY);
          byte[] data = ((ShortBuffer) m.getObject(DMT.DATA)).getData();
          byte[] headers = ((ShortBuffer) m.getObject(DMT.BLOCK_HEADERS)).getData();
          short htl = m.getShort(DMT.HTL);
      if(htl <= 0) htl = 1;
      SSKInsertHandler rh = new SSKInsertHandler(key, data, headers, htl, source, id, node, now, tag, node.canWriteDatastoreInsert(htl), forkOnCacheable, preferInsert, ignoreLowBackoff, realTimeFlag);
          rh.receivedBytes(m.receivedByteCount());
      node.executor.execute(rh, "SSKInsertHandler for "+id+" on "+node.getDarknetPortNumber());
    } else if(m.getSpec().equals(DMT.FNPSSKInsertRequestNew)) {
      NodeSSK key = (NodeSSK) m.getObject(DMT.FREENET_ROUTING_KEY);
      short htl = m.getShort(DMT.HTL);
      if(htl <= 0) htl = 1;
      SSKInsertHandler rh = new SSKInsertHandler(key, null, null, htl, source, id, node, now, tag, node.canWriteDatastoreInsert(htl), forkOnCacheable, preferInsert, ignoreLowBackoff, realTimeFlag);
          rh.receivedBytes(m.receivedByteCount());
      node.executor.execute(rh, "SSKInsertHandler for "+id+" on "+node.getDarknetPortNumber());
View Full Code Here

TOP

Related Classes of freenet.keys.NodeSSK

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.