Package com.subgraph.orchid

Examples of com.subgraph.orchid.TorException


  private byte[] encryptSimple(byte[] data, TorPublicKey publicKey) {
    try {
      cipher.init(Cipher.ENCRYPT_MODE, publicKey.getRSAPublicKey());
      return cipher.doFinal(data);
    } catch (InvalidKeyException e) {
      throw new TorException(e);
    } catch (IllegalBlockSizeException e) {
      throw new TorException(e);
    } catch (BadPaddingException e) {
      throw new TorException(e);
    }
  }
View Full Code Here


   * @return A new byte array containing the decrypted data.
   */
 
  public byte[] decrypt(byte[] data, TorPrivateKey privateKey) {
    if(data.length < PK_ENC_LEN)
      throw new TorException("Message is too short");
   
    if(data.length == PK_ENC_LEN)
      return decryptSimple(data, privateKey);
   
    // ( C1 | C2 ) --> C1, C2
View Full Code Here

  private byte[] decryptSimple(byte[] data, TorPrivateKey privateKey) {
    try {
      cipher.init(Cipher.DECRYPT_MODE, privateKey.getRSAPrivateKey());
      return cipher.doFinal(data);
    } catch (InvalidKeyException e) {
      throw new TorException(e);
    } catch (IllegalBlockSizeException e) {
      throw new TorException(e);
    } catch (BadPaddingException e) {
      throw new TorException(e);
    }
  }
View Full Code Here

    case 0:
      return new HSDescriptorCookie(CookieType.COOKIE_BASIC, cookie);
    case 1:
      return new HSDescriptorCookie(CookieType.COOKIE_STEALTH, cookie);
    default:
      throw new TorException("Illegal cookie descriptor with flag value: "+ flag);
    }
  }
View Full Code Here

      break;
    }
    try {
      return Base64.decode(string.toString().getBytes("ISO-8859-1"));
    } catch (UnsupportedEncodingException e) {
      throw new TorException(e);
    }

  }
View Full Code Here

    return currentKeyword;
  }

  public void processDocument() {
    if(callbackHandler == null)
      throw new TorException("DocumentFieldParser#processDocument() called with null callbackHandler");

    while(true) {
      final String line = readLine();
      if(line == null) {
        callbackHandler.endOfDocument();
View Full Code Here

    waitUntilLoaded();
    final List<Router> routers = new ArrayList<Router>();
    for(String n: names) {
      final Router r = getRouterByName(n);
      if(r == null)
        throw new TorException("Could not find router named: "+ n);
      routers.add(r);
    }
    return routers;
  }
View Full Code Here

public class RelayCellImpl extends CellImpl implements RelayCell {

  public static RelayCell createFromCell(CircuitNode node, Cell cell) {
    if(cell.getCommand() != Cell.RELAY)
      throw new TorException("Attempted to create RelayCell from Cell type: "+ cell.getCommand());
    return new RelayCellImpl(node, cell.getCellBytes());
  }
View Full Code Here

    this.isOutgoing = false;
    getInt();
    int payloadLength = getShort();
    cellBuffer.mark(); // End of header
    if(RelayCell.HEADER_SIZE + payloadLength > rawCell.length)
      throw new TorException("Header length field exceeds total size of cell");
    cellBuffer.limit(RelayCell.HEADER_SIZE + payloadLength);
  }
View Full Code Here

 
  private static SecureRandom createRandom() {
    try {
      return SecureRandom.getInstance("SHA1PRNG");
    } catch (NoSuchAlgorithmException e) {
      throw new TorException(e);
    }
  }
View Full Code Here

TOP

Related Classes of com.subgraph.orchid.TorException

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.