Beispiel #1
0
 public void writeBytes(OutputStream out) throws DataFormatException, IOException {
   if ((_destination == null)
       || (_options == null)
       || (_signature == null)
       || (_creationDate == null))
     throw new DataFormatException("Not enough data to create the session config");
   _destination.writeBytes(out);
   DataHelper.writeProperties(out, _options, true); // UTF-8
   DataHelper.writeDate(out, _creationDate);
   _signature.writeBytes(out);
 }
Beispiel #2
0
  private byte[] getBytes() {
    if (_destination == null) return null;
    if (_options == null) return null;
    if (_creationDate == null) return null;

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {
      // _log.debug("PubKey size for destination: " + _destination.getPublicKey().getData().length);
      // _log.debug("SigningKey size for destination: " +
      // _destination.getSigningPublicKey().getData().length);
      _destination.writeBytes(out);
      DataHelper.writeProperties(out, _options, true); // UTF-8
      DataHelper.writeDate(out, _creationDate);
    } catch (IOException ioe) {
      _log.error("IOError signing", ioe);
      return null;
    } catch (DataFormatException dfe) {
      _log.error("Error writing out the bytes for signing/verification", dfe);
      return null;
    }
    return out.toByteArray();
  }