Class SignedMessage
- java.lang.Object
-
- org.drasyl.peer.connection.message.SignedMessage
-
public class SignedMessage extends Object implements Message, Signable
Represents a container with a signature for thepayload
. Thesignature
must be valid under the suppliedpublic key
.
Thesignature
does not give any guarantees about the logical integrity of thepayload
, but only guarantees that thepayload
was sent by the identity with thepublic key
(as the last node in a relay chain).
-
-
Constructor Summary
Constructors Constructor Description SignedMessage(Message payload, CompressedPublicKey kid)
SignedMessage(Message payload, CompressedPublicKey kid, Signature signature)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
MessageId
getId()
CompressedPublicKey
getKid()
Message
getPayload()
Signature
getSignature()
Returns the signature this signable object was signed with.int
hashCode()
void
setSignature(Signature signature)
Signs the object with the specified signature.String
toString()
void
writeFieldsTo(OutputStream outstream)
Write any content into the passed output-stream to have them included in the signing process.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.drasyl.crypto.Signable
getSignableBytes
-
-
-
-
Constructor Detail
-
SignedMessage
public SignedMessage(Message payload, CompressedPublicKey kid)
-
SignedMessage
public SignedMessage(Message payload, CompressedPublicKey kid, Signature signature)
-
-
Method Detail
-
getPayload
public Message getPayload()
-
getKid
public CompressedPublicKey getKid()
-
writeFieldsTo
public void writeFieldsTo(OutputStream outstream) throws IOException
Description copied from interface:Signable
Write any content into the passed output-stream to have them included in the signing process.
Only use this with the default-implementation of
Signable.getSignableBytes()
- Specified by:
writeFieldsTo
in interfaceSignable
- Parameters:
outstream
- an outputstream to write to- Throws:
IOException
-
getSignature
public Signature getSignature()
Description copied from interface:Signable
Returns the signature this signable object was signed with.- Specified by:
getSignature
in interfaceSignable
-
setSignature
public void setSignature(Signature signature)
Description copied from interface:Signable
Signs the object with the specified signature. After this method was invoked subsequent calls toSignable.getSignature()
should return aSignature
object that is equal to the specifiedsignature
.- Specified by:
setSignature
in interfaceSignable
-
getId
public MessageId getId()
-
-