public class SignMessage extends Message
Sign1Message can be used instead.
There is no way to convert a signed message between the two formats.
Create a SignMessage object for a new message, when processing an existing message use Message.DecodeFromBytes to create a SignMessage object.
Examples can be found at
Single Signer Example an example of signing and verify a message with a single signature.
Multiple Signer Example an example of signing and verifying a message which has multiple signatures.
| Modifier and Type | Field and Description |
|---|---|
protected List<Signer> |
signerList |
emitContent, emitTag, messageTag, rgbContentDO_NOT_SEND, DontSendAttributes, externalData, objDontSend, objProtected, objUnprotected, PROTECTED, ProtectedAttributes, rgbProtected, UNPROTECTED, UnprotectedAttributes| Constructor and Description |
|---|
SignMessage()
Create a signed message object for which the leading tag and the content will be included.
|
SignMessage(boolean emitTagIn,
boolean emitContentIn)
Create a signed message object for which the emission of the leading tag and content is controlled by the parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
AddSigner(Signer signedBy)
Add a new signer to the message.
|
protected void |
DecodeFromCBORObject(com.upokecenter.cbor.CBORObject obj)
Internal function used in creating a SignMessage object from a byte string.
|
protected com.upokecenter.cbor.CBORObject |
EncodeCBORObject()
Internal function used to create a serialization of a COSE_Sign message
|
Signer |
getSigner(int iSigner)
Return the i-th signer of the message.
|
int |
getSignerCount()
Return the number of signers on the message
|
List<Signer> |
getSignerList()
Return the list of signers on the message
|
void |
sign()
Causes a signature to be created for every signer that does not already have one.
|
boolean |
validate(Signer signerToUse)
Validate the signature on a message for a specific signer.
|
DecodeFromBytes, DecodeFromBytes, EncodeToBytes, EncodeToCBORObject, GetContent, HasContent, SetContent, SetContentaddAttribute, addAttribute, addAttribute, AddProtected, AddProtected, AddProtected, AddUnprotected, AddUnprotected, AddUnprotected, findAttribute, findAttribute, findAttribute, findAttribute, getDoNotSendAttributes, getExternal, getProtectedAttributes, getUnprotectedAttributes, removeAttribute, removeAttribute, setExternalpublic SignMessage()
public SignMessage(boolean emitTagIn,
boolean emitContentIn)
emitTagIn - emit leading tag when message is serializedemitContentIn - emit the content as part of the messageprotected void DecodeFromCBORObject(com.upokecenter.cbor.CBORObject obj)
throws CoseException
DecodeFromCBORObject in class Messageobj - COSE_Sign encoded object.CoseException - Errors generated by the COSE moduleprotected com.upokecenter.cbor.CBORObject EncodeCBORObject()
throws CoseException
EncodeCBORObject in class MessageCoseException - Errors generated by the COSE modulepublic void AddSigner(Signer signedBy)
signedBy - provides a Signer object containing details for the signerpublic Signer getSigner(int iSigner)
iSigner - - which signer to be returnedpublic int getSignerCount()
public List<Signer> getSignerList()
public void sign()
throws CoseException
CoseException - Errors generated by the COSE modulepublic boolean validate(Signer signerToUse) throws CoseException
signerToUse - which signer to validate withCoseException - Errors generated by the COSE moduleCOSE for Java documentation, generatedin 2018.