code: protected byte[] getSignedData() throws KSIException {
          ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
          try {
              byteStream.write(FILE_BEGINNING_MAGIC_BYTES);
              for (TLVElement element : elements) {
                  if (ELEMENT_TYPE_CMS_SIGNATURE != element.getType()) {
                      element.writeTo(byteStream);
                  }
              }
          } catch (IOException e) {
              return new byte[]{};
          }
  
          return byteStream.toByteArray();
      }
docs: Get publications file bytes without signature.
  
  @return byte array of publication file bytes without signature