Package com.subgraph.orchid.crypto

Examples of com.subgraph.orchid.crypto.TorMessageDigest


  }

  private void doFirstSignature() {
    seenFirstSignature = true;
    fieldParser.endSignedEntity();
    final TorMessageDigest messageDigest = fieldParser.getSignatureMessageDigest();
    messageDigest.update("directory-signature ");
    document.setSigningHash(messageDigest.getHexDigest());
   
    TorMessageDigest messageDigest256 = fieldParser.getSignatureMessageDigest256();
    messageDigest256.update("directory-signature ");
    document.setSigningHash256(messageDigest256.getHexDigest());
  }
View Full Code Here


    ids.add(getCurrentDescriptorId(1));
    return ids;
  }

  HexDigest getCurrentDescriptorId(int replica) {
    final TorMessageDigest digest = new TorMessageDigest();
    digest.update(permanentId);
    digest.update(getCurrentSecretId(replica));
    return digest.getHexDigest();
  }
View Full Code Here

    digest.update(getCurrentSecretId(replica));
    return digest.getHexDigest();
  }

  byte[] getCurrentSecretId(int replica) {
    final TorMessageDigest digest = new TorMessageDigest();
    digest.update(getCurrentTimePeriod());
    final HSDescriptorCookie cookie = getAuthenticationCookie();
    if(cookie != null && cookie.getType() == CookieType.COOKIE_STEALTH) {
      digest.update(cookie.getValue());
    }
    digest.update(new byte[] { (byte) replica });
    return digest.getDigestBytes();
  }
View Full Code Here

    }
  }

  public void startSignedEntity() {
    isProcessingSignedEntity = true;
    signatureDigest = new TorMessageDigest();
    signatureDigest256 = new TorMessageDigest(true);
  }
View Full Code Here

    fieldParser.resetRawDocument(RouterMicrodescriptorKeyword.ONION_KEY.getKeyword() + "\n");
    currentDescriptor.setOnionKey(fieldParser.parsePublicKey());
  }

  private void finalizeDescriptor(RouterMicrodescriptorImpl descriptor) {
    final TorMessageDigest digest = new TorMessageDigest(true);
    digest.update(descriptor.getRawDocumentData());
    descriptor.setDescriptorDigest(digest.getHexDigest());
    if(!descriptor.isValidDocument()) {
      resultHandler.documentInvalid(descriptor, "Microdescriptor data invalid");
    } else {
      resultHandler.documentParsed(descriptor);
    }
View Full Code Here

    b.get(iv);
    return iv;
  }

  private byte[] generateAuthId(byte[] iv) {
    final TorMessageDigest md = new TorMessageDigest();
    md.update(cookie.getValue());
    md.update(iv);
    final byte[] digest = md.getDigestBytes();
    final byte[] id = new byte[BASIC_ID_LENGTH];
    System.arraycopy(digest, 0, id, 0, BASIC_ID_LENGTH);
    return id;
  }
View Full Code Here

  public static HexDigest createFromDigestBytes(byte[] data) {
    return new HexDigest(data);
  }
 
  public static HexDigest createDigestForData(byte[] data) {
    final TorMessageDigest digest = new TorMessageDigest();
    digest.update(data);
    return new HexDigest(digest.getDigestBytes());
  }
View Full Code Here

 
  private CircuitNodeCryptoState(byte[] keyMaterial, byte[] verifyDigest) {
    checksumDigest = HexDigest.createFromDigestBytes(verifyDigest);
    int offset = 0;
   
    forwardDigest = new TorMessageDigest();
    forwardDigest.update(extractDigestBytes(keyMaterial, offset));
    offset += TorMessageDigest.TOR_DIGEST_SIZE;

    backwardDigest = new TorMessageDigest();
    backwardDigest.update(extractDigestBytes(keyMaterial, offset));
    offset += TorMessageDigest.TOR_DIGEST_SIZE;
   
    forwardCipher = TorStreamCipher.createFromKeyBytes(extractCipherKey(keyMaterial, offset));
    offset += TorStreamCipher.KEY_LEN;
View Full Code Here

TOP

Related Classes of com.subgraph.orchid.crypto.TorMessageDigest

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.