Examples of TorParsingException


Examples of com.subgraph.orchid.TorParsingException

  private void parseObjectBody(DocumentObject object, String keyword) {
    final String endTag = END_TAG +" "+ keyword +TAG_DELIMITER;
    while(true) {
      final String line = readLine();
      if(line == null) {
        throw new TorParsingException("EOF reached before end of '"+ keyword +"' object.");
      }
      if(line.equals(endTag)) {
        object.addFooterLine(line);
        return;
      }
View Full Code Here

Examples of com.subgraph.orchid.TorParsingException

  }
 
  private void processProtocols() {
    String kw = fieldParser.parseString();
    if(!kw.equals("Link"))
      throw new TorParsingException("Expected 'Link' token in protocol line got: " + kw);
    while(true) {
      kw = fieldParser.parseString();
      if(kw.equals("Circuit"))
        break;
      currentDescriptor.addLinkProtocolVersion(fieldParser.parseInteger(kw));
View Full Code Here

Examples of com.subgraph.orchid.TorParsingException

    return new BasicAuthEntry(id, skey);
  }
 
  private byte[] decryptIntroductionPointsWithBasicAuth(ByteBuffer buffer) throws HSAuthenticationException {
    if(cookie == null || cookie.getType() != CookieType.COOKIE_BASIC) {
      throw new TorParsingException("Introduction points encrypted with 'basic' authentication and no cookie available to decrypt");
    }

    final List<BasicAuthEntry> entries = readBasicEntries(buffer);
    final byte[] iv = readAuthIV(buffer);
    final byte[] id = generateAuthId(iv);
View Full Code Here

Examples of com.subgraph.orchid.TorParsingException

    return remaining;
  }
 
  private byte[] decryptIntroductionPointsWithStealthAuth(ByteBuffer buffer) {
    if(cookie == null || cookie.getType() != CookieType.COOKIE_STEALTH) {
      throw new TorParsingException("Introduction points encrypted with 'stealth' authentication and no cookie available to descrypt");
    }
    final byte[] iv = readAuthIV(buffer);
    return decryptRemaining(buffer, cookie.getValue(), iv);
  }
View Full Code Here

Examples of com.subgraph.orchid.TorParsingException

    case RENDEZVOUS_SERVICE_DESCRIPTOR:
      descriptor.setDescriptorId(fieldParser.parseBase32Digest());
      break;
    case VERSION:
      if(fieldParser.parseInteger() != 2) {
        throw new TorParsingException("Unexpected Descriptor version");
      }
      break;
     
    case PERMANENT_KEY:
      descriptor.setPermanentKey(fieldParser.parsePublicKey());
View Full Code Here

Examples of com.subgraph.orchid.TorParsingException

    } else {
      try {
        byte[] decrypted = authentication.decryptIntroductionPoints(content);
        return ByteBuffer.wrap(decrypted);
      } catch (HSAuthenticationException e) {
        throw new TorParsingException("Failed to decrypt introduction points: "+ e.getMessage());
      }
    }
  }
View Full Code Here

Examples of com.subgraph.orchid.TorParsingException

    format.setLenient(false);
    try {
      Timestamp ts = new Timestamp(format.parse(dateAndTime));
      return ts;
    } catch (ParseException e) {
      throw new TorParsingException("Could not parse timestamp string: "+ dateAndTime);
    }
  }
View Full Code Here

Examples of com.subgraph.orchid.TorParsingException

 
  private static int octetStringToInt(String octet) {
    try {
      int result = Integer.parseInt(octet);
      if(result < 0 || result > 255)
        throw new TorParsingException("Octet out of range: " + octet);
      return result;
    } catch(NumberFormatException e) {
      throw new TorParsingException("Failed to parse octet: " + octet);
   
  }
View Full Code Here

Examples of com.subgraph.orchid.TorParsingException

    final IPv4Address network = IPv4Address.createFromString(parts[0]);
    if(parts.length == 1)
      return new Network(network, 32, networkString);
   
    if(parts.length != 2)
      throw new TorParsingException("Invalid network CIDR notation: " + networkString);

    try {
      final int maskBits = Integer.parseInt(parts[1]);
      return new Network(network, maskBits, networkString);
    } catch(NumberFormatException e) {
      throw new TorParsingException("Invalid netblock mask bit value: " + parts[1]);
    }
  }
View Full Code Here

Examples of com.subgraph.orchid.TorParsingException

    if(parts.length == 1) {
      return new PortRange(stringToPort(parts[0]));
    } else if(parts.length == 2) {
      return new PortRange(stringToPort(parts[0]), stringToPort(parts[1]));
    } else {
      throw new TorParsingException("Could not parse port range from string: " + ports);
    }
  }
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.