Package ch.ethz.inf.vs.scandium.util

Examples of ch.ethz.inf.vs.scandium.util.DatagramWriter.toByteArray()


    for (ECPointFormat format : ecPointFormatList) {
      writer.write(format.getId(), POINT_FORMAT_BITS);
    }

    return writer.toByteArray();
  }

  public static HelloExtension fromByteArray(byte[] byteArray) {
    DatagramReader reader = new DatagramReader(byteArray);
View Full Code Here


      // since a distinguished name has variable length, we need to write length field for each name as well, has influence on total length!
      writer.write(distinguishedName.getName().length, CERTIFICATE_AUTHORITY_LENGTH_BITS);
      writer.writeBytes(distinguishedName.getName());
    }

    return writer.toByteArray();
  }

  public static HandshakeMessage fromByteArray(byte[] byteArray) {
    DatagramReader reader = new DatagramReader(byteArray);
   
View Full Code Here

  public byte[] fragmentToByteArray() {
    DatagramWriter writer = new DatagramWriter();
   
    writer.writeBytes(verifyData);

    return writer.toByteArray();
  }

  public static HandshakeMessage fromByteArray(byte[] byteArray) {
    DatagramReader reader = new DatagramReader(byteArray);
View Full Code Here

    writer.write(signatureAndHashAlgorithm.getSignature().getCode(), SIGNATURE_ALGORITHM_BITS);

    writer.write(signatureBytes.length, SIGNATURE_LENGTH_BITS);
    writer.writeBytes(signatureBytes);

    return writer.toByteArray();
  }

  public static HandshakeMessage fromByteArray(byte[] byteArray) {
    DatagramReader reader = new DatagramReader(byteArray);
View Full Code Here

    writer.write(serverVersion.getMinor(), VERSION_BITS);

    writer.write(cookie.length(), COOKIE_LENGTH_BITS);
    writer.writeBytes(cookie.getCookie());

    return writer.toByteArray();
  }

  public static HandshakeMessage fromByteArray(byte[] byteArray) {
    DatagramReader reader = new DatagramReader(byteArray);
View Full Code Here

      writer.write(getMessageLength() - 3, CERTIFICATE_LIST_LENGTH);
      writer.write(rawPublicKeyBytes.length, CERTIFICATE_LENGTH_BITS);
      writer.writeBytes(rawPublicKeyBytes);
    }

    return writer.toByteArray();
  }

  public static HandshakeMessage fromByteArray(byte[] byteArray, boolean useRawPublicKey) {

    DatagramReader reader = new DatagramReader(byteArray);
View Full Code Here

    }
    writer.write(fragmentLength, FRAGMENT_LENGTH_BITS);
   
    writer.writeBytes(fragmentToByteArray());

    return writer.toByteArray();
  }

  public static HandshakeMessage fromByteArray(byte[] byteArray, KeyExchangeAlgorithm keyExchange, boolean useRawPublicKey) throws HandshakeException {
    DatagramReader reader = new DatagramReader(byteArray);
    HandshakeType type = HandshakeType.getTypeByCode(reader.read(MESSAGE_TYPE_BITS));
View Full Code Here

    writer.write(getLength(), LENGTH_BITS);
    for (HelloExtension extension : extensions) {
      writer.writeBytes(extension.toByteArray());
    }

    return writer.toByteArray();
  }

  public static HelloExtensions fromByteArray(byte[] byteArray) throws HandshakeException {
    DatagramReader reader = new DatagramReader(byteArray);
    List<HelloExtension> extensions = new ArrayList<HelloExtension>();
View Full Code Here

    for (Integer curveId : ellipticCurveList) {
      writer.write(curveId, CURVE_BITS);
    }

    return writer.toByteArray();
  }

  public static HelloExtension fromByteArray(byte[] byteArray) {
    DatagramReader reader = new DatagramReader(byteArray);
View Full Code Here

  // @Override
  public byte[] toByteArray() {
    DatagramWriter writer = new DatagramWriter();
    writer.write(CCSProtocolType.getCode(), CCS_BITS);

    return writer.toByteArray();
  }

  public static DTLSMessage fromByteArray(byte[] byteArray) throws HandshakeException {
    DatagramReader reader = new DatagramReader(byteArray);
    int code = reader.read(CCS_BITS);
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.