示例#1
0
  public byte[] toWireForm(WireMsg msg) throws WireFormException {
    try {

      msg.setTrailerSize(macData.getMacSize());
      //            msg.setTrailerSize(100);
      byte[] wireForm = msg.toWire();
      macData.addMAC(wireForm, 0, msg.getSize() - 1);
      return wireForm;

    } catch (IOException e) {
      throw new WireFormException("Unable to marshall message", e);
    } catch (ShortBufferException e) {
      throw new WireFormException(
          "Unable to marshall message - buffer not large enough for MAC security data", e);
    } catch (SecurityException e) {
      throw new WireFormException("Unable to marshall message - security issue", e);
    }
  }