Interface Signable

All Known Implementing Classes:
SignedMessage

public interface Signable
Instances of classes that implement this interface are considered signable. A signable object can be converted into a signature and can store that signature itself.
  • Method Summary

    Modifier and Type
    Method
    Description
    default byte[]
    Returns a byte representation of the object that can be used for signing the object.
    Returns the signature this signable object was signed with.
    void
    Signs the object with the specified signature.
    default void
    Write any content into the passed output-stream to have them included in the signing process.
  • Method Details

    • getSignableBytes

      default byte[] getSignableBytes()

      Returns a byte representation of the object that can be used for signing the object. Attention: If you omit fields in this method those fields will not be signed. That means that they can be modified by a third party without detection.

      The default-implementation creates a ByteArrayOutputStream and calls writeFieldsTo(OutputStream) to have content written to it.

      Returns:
      byte-array or null
    • writeFieldsTo

      default void writeFieldsTo(OutputStream outstream) throws IOException

      Write any content into the passed output-stream to have them included in the signing process.

      Only use this with the default-implementation of getSignableBytes()

      Parameters:
      outstream - an outputstream to write to
      Throws:
      IOException
    • getSignature

      Signature getSignature()
      Returns the signature this signable object was signed with.
    • setSignature

      void setSignature(Signature signature)
      Signs the object with the specified signature. After this method was invoked subsequent calls to getSignature() should return a Signature object that is equal to the specified signature.