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

Examples of ch.ethz.inf.vs.scandium.util.DatagramReader.readBytes()


      // decode the length of the value, if encoded into multiply bytes
      if (length > 127) {
        int additionalBytes = length & 0x7F;
        length = reader.read(additionalBytes * OCTET_BITS);
      }
      byte[] fragment = reader.readBytes(length);

      switch (tag) {
      case SEQUENCE_TAG:
        readTLV(fragment, rawPublicKey);
        break;
View Full Code Here


    int major = reader.read(VERSION_BITS);
    int minor = reader.read(VERSION_BITS);
    ProtocolVersion version = new ProtocolVersion(major, minor);

    Random random = new Random(reader.readBytes(RANDOM_BYTES));

    int sessionIdLength = reader.read(SESSION_ID_LENGTH_BITS);
    SessionId sessionId = new SessionId(reader.readBytes(sessionIdLength));

    CipherSuite cipherSuite = CipherSuite.getTypeByCode(reader.read(CIPHER_SUITE_BITS));
View Full Code Here

    ProtocolVersion version = new ProtocolVersion(major, minor);

    Random random = new Random(reader.readBytes(RANDOM_BYTES));

    int sessionIdLength = reader.read(SESSION_ID_LENGTH_BITS);
    SessionId sessionId = new SessionId(reader.readBytes(sessionIdLength));

    CipherSuite cipherSuite = CipherSuite.getTypeByCode(reader.read(CIPHER_SUITE_BITS));
    CompressionMethod compressionMethod = CompressionMethod.getMethodByCode(reader.read(COMPRESSION_METHOD_BITS));

    byte[] bytesLeft = reader.readBytesLeft();
View Full Code Here

 
  public static HandshakeMessage fromByteArray(byte[] byteArray) {
    DatagramReader reader = new DatagramReader(byteArray);
   
    int length = reader.read(IDENTITY_HINT_LENGTH_BITS);
    byte[] hintEncoded = reader.readBytes(length);
   
    return new PSKServerKeyExchange(hintEncoded);
  }
 
  // Getters and Setters ////////////////////////////////////////////
View Full Code Here

    int major = reader.read(VERSION_BITS);
    int minor = reader.read(VERSION_BITS);
    ProtocolVersion clientVersion = new ProtocolVersion(major, minor);

    Random random = new Random(reader.readBytes(RANDOM_BYTES));

    int sessionIdLength = reader.read(SESSION_ID_LENGTH_BITS);
    SessionId sessionId = new SessionId(reader.readBytes(sessionIdLength));

    int cookieLength = reader.read(COOKIE_LENGTH);
View Full Code Here

    ProtocolVersion clientVersion = new ProtocolVersion(major, minor);

    Random random = new Random(reader.readBytes(RANDOM_BYTES));

    int sessionIdLength = reader.read(SESSION_ID_LENGTH_BITS);
    SessionId sessionId = new SessionId(reader.readBytes(sessionIdLength));

    int cookieLength = reader.read(COOKIE_LENGTH);
    Cookie cookie = new Cookie(reader.readBytes(cookieLength));

    int cipherSuitesLength = reader.read(CIPHER_SUITS_LENGTH_BITS);
View Full Code Here

    int sessionIdLength = reader.read(SESSION_ID_LENGTH_BITS);
    SessionId sessionId = new SessionId(reader.readBytes(sessionIdLength));

    int cookieLength = reader.read(COOKIE_LENGTH);
    Cookie cookie = new Cookie(reader.readBytes(cookieLength));

    int cipherSuitesLength = reader.read(CIPHER_SUITS_LENGTH_BITS);
    List<CipherSuite> cipherSuites = CipherSuite.listFromByteArray(reader.readBytes(cipherSuitesLength), cipherSuitesLength / 2); // 2

    int compressionMethodsLength = reader.read(COMPRESSION_METHODS_LENGTH_BITS);
View Full Code Here

    int cookieLength = reader.read(COOKIE_LENGTH);
    Cookie cookie = new Cookie(reader.readBytes(cookieLength));

    int cipherSuitesLength = reader.read(CIPHER_SUITS_LENGTH_BITS);
    List<CipherSuite> cipherSuites = CipherSuite.listFromByteArray(reader.readBytes(cipherSuitesLength), cipherSuitesLength / 2); // 2

    int compressionMethodsLength = reader.read(COMPRESSION_METHODS_LENGTH_BITS);
    List<CompressionMethod> compressionMethods = CompressionMethod.listFromByteArray(reader.readBytes(compressionMethodsLength), compressionMethodsLength);

    byte[] bytesLeft = reader.readBytesLeft();
View Full Code Here

    int cipherSuitesLength = reader.read(CIPHER_SUITS_LENGTH_BITS);
    List<CipherSuite> cipherSuites = CipherSuite.listFromByteArray(reader.readBytes(cipherSuitesLength), cipherSuitesLength / 2); // 2

    int compressionMethodsLength = reader.read(COMPRESSION_METHODS_LENGTH_BITS);
    List<CompressionMethod> compressionMethods = CompressionMethod.listFromByteArray(reader.readBytes(compressionMethodsLength), compressionMethodsLength);

    byte[] bytesLeft = reader.readBytesLeft();
    HelloExtensions extensions = null;
    if (bytesLeft.length > 0) {
      extensions = HelloExtensions.fromByteArray(bytesLeft);
View Full Code Here

  }

  public static HandshakeMessage fromByteArray(byte[] byteArray) {
    DatagramReader reader = new DatagramReader(byteArray);
    int length = reader.read(LENGTH_BITS);
    byte[] pointEncoded = reader.readBytes(length);

    return new ECDHClientKeyExchange(pointEncoded);
  }
 
  // Methods ////////////////////////////////////////////////////////
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.