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

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


    default:
      LOGGER.severe("Unknown curve type: " + curveId);
      break;
    }

    return writer.toByteArray();
  }

  public static HandshakeMessage fromByteArray(byte[] byteArray) throws HandshakeException {
    DatagramReader reader = new DatagramReader(byteArray);
    int curveType = reader.read(CURVE_TYPE_BITS);
View Full Code Here


    DatagramWriter writer = new DatagramWriter();
   
    writer.write(identityEncoded.length, IDENTITY_LENGTH_BITS);
    writer.writeBytes(identityEncoded);
   
    return writer.toByteArray();
  }
 
  public static HandshakeMessage fromByteArray(byte[] byteArray) {
    DatagramReader reader = new DatagramReader(byteArray);
   
View Full Code Here

    DatagramWriter writer = new DatagramWriter();

    writer.write(level.getCode(), BITS);
    writer.write(description.getCode(), BITS);

    return writer.toByteArray();
  }

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

  public byte[] toByteArray() {
    DatagramWriter writer = new DatagramWriter();

    writer.write(type.getId(), TYPE_BITS);

    return writer.toByteArray();
  }
 
  public static HelloExtension fromByteArray(byte[] byteArray, ExtensionType type) throws HandshakeException {

    switch (type) {
View Full Code Here

    byte[] subjectPublicKeyBytes = writeTLV(BIT_STRING_TAG, subjectPublicKey);
    byte[] subjectPublicKeyInfo = writeTLV(SEQUENCE_TAG, ByteArrayUtils.concatenate(algorithmIdentifierBytes, subjectPublicKeyBytes));

    writer.writeBytes(subjectPublicKeyInfo);

    return writer.toByteArray();
  }

  public static RawPublicKey fromByteArray(byte[] byteArray) {

    RawPublicKey rawPublicKey = new RawPublicKey();
View Full Code Here

       */
      writer.write(length, OCTET_BITS);
    }
    writer.writeBytes(value);

    return writer.toByteArray();
  }

  /**
   * Decodes a given byte stream into a OBJECT IDENTIFIER data type. See <a
   * href=
 
View Full Code Here

    if (extensions != null) {
      writer.writeBytes(extensions.toByteArray());
    }

    return writer.toByteArray();
  }

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

    DatagramWriter writer = new DatagramWriter();
   
    writer.write(hintEncoded.length, IDENTITY_HINT_LENGTH_BITS);
    writer.writeBytes(hintEncoded);
   
    return writer.toByteArray();
  }
 
  public static HandshakeMessage fromByteArray(byte[] byteArray) {
    DatagramReader reader = new DatagramReader(byteArray);
   
View Full Code Here

      // we assume the list contains exactly one element
      writer.write(1, LENGTH_BITS);
      writer.write(certificateTypes.get(0).getCode(), EXTENSION_TYPE_BITS);
    }
   
    return writer.toByteArray();
  }
 
  // Enums //////////////////////////////////////////////////////////

  /**
 
View Full Code Here

    if (extensions != null) {
      writer.writeBytes(extensions.toByteArray());
    }

    return writer.toByteArray();
  }

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