Examples of PeerParseException


Examples of freenet.io.comm.PeerParseException

    testnetEnabled = fs.getBoolean("testnet", false);
    if(testnetEnabled) {
      String err = "Ignoring incompatible testnet node " + detectedPeer;
      Logger.error(this, err);
      throw new PeerParseException(err);
    }

    negTypes = fs.getIntArray("auth.negTypes");
    if(negTypes == null || negTypes.length == 0) {
      if(fromAnonymousInitiator)
        negTypes = mangler.supportedNegTypes(false); // Assume compatible. Anonymous initiator = short-lived, and we already connected so we know we are.
      else
        throw new FSParseException("No negTypes!");
    }

    if(fs.getBoolean("opennet", false) != isOpennet)
      throw new FSParseException("Trying to parse a darknet peer as opennet or an opennet peer as darknet isOpennet="+isOpennet+" boolean = "+fs.getBoolean("opennet", false)+" string = \""+fs.get("opennet")+"\"");

    /* Read the DSA key material for the peer */
    try {
      SimpleFieldSet sfs = fs.subset("dsaGroup");
      if(sfs == null) {
          this.peerCryptoGroup = Global.DSAgroupBigA;
        fs.put("dsaGroup", this.peerCryptoGroup.asFieldSet());
      } else
          this.peerCryptoGroup = DSAGroup.create(sfs);

      sfs = fs.subset("dsaPubKey");
      if(sfs == null || peerCryptoGroup == null)
        throw new FSParseException("No dsaPubKey - very old reference?");
      else {
        this.peerPubKey = DSAPublicKey.create(sfs, peerCryptoGroup);
        pubKeyHash = SHA256.digest(peerPubKey.asBytes());
        pubKeyHashHash = SHA256.digest(pubKeyHash);
      }
     
      parseECDSA(fs, fromAnonymousInitiator, true);
      if(noSig || verifyReferenceSignature(fs)) {
        this.isSignatureVerificationSuccessfull = true;
      }
    } catch(IllegalBase64Exception e) {
      Logger.error(this, "Caught " + e, e);
      throw new FSParseException(e);
    }

    // Identifier

    if(!generateIdentityFromPubkey()) {
      String identityString = fs.get("identity");
      if(identityString == null)
        throw new PeerParseException("No identity!");
      try {
        identity = Base64.decode(identityString);
      } catch(NumberFormatException e) {
        throw new FSParseException(e);
      } catch(IllegalBase64Exception e) {
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.