public static CertificateMessage fromByteArray(final byte[] byteArray,boolean useRawPublicKey,InetSocketAddress peerAddress) throws HandshakeException {
  DatagramReader reader=new DatagramReader(byteArray);
  if (useRawPublicKey) {
    LOGGER.log(Level.FINER,"Parsing RawPublicKey CERTIFICATE message");
    int certificateLength=reader.read(CERTIFICATE_LENGTH_BITS);
    byte[] rawPublicKey=reader.readBytes(certificateLength);
    return new CertificateMessage(rawPublicKey,peerAddress);
  }
 else {
    return readX509CertificateMessage(reader,peerAddress);
  }
}

public static CertificateMessage fromByteArray ( final byte [ ] byteArray , boolean useRawPublicKey , InetSocketAddress peerAddress ) throws HandshakeException { DatagramReader reader = new DatagramReader ( byteArray ) ; if ( useRawPublicKey ) { LOGGER . log ( Level . FINER , "Parsing RawPublicKey CERTIFICATE message" ) ; int certificateLength = reader . read ( CERTIFICATE_LENGTH_BITS ) ; byte [ ] rawPublicKey = reader . readBytes ( certificateLength ) ; return new CertificateMessage ( rawPublicKey , peerAddress ) ; } else { return readX509CertificateMessage ( reader , peerAddress ) ; } }
creates a certificate message from its binary encoding .
