public class Sign1Message extends SignCommon
SignMessage need to be used in those cases where more than one signature is needed on a content.
There is no way to convert a signed message between the two formats.
Create a Sign1Message object for a new message, when processing an existing message use Message.DecodeFromBytes to create the Sign1Message object.
There are examples of using this class:
Simple Example
contextStringemitContent, emitTag, messageTag, rgbContentDO_NOT_SEND, DontSendAttributes, externalData, objDontSend, objProtected, objUnprotected, PROTECTED, ProtectedAttributes, rgbProtected, UNPROTECTED, UnprotectedAttributes| Constructor and Description |
|---|
Sign1Message()
Create a signed message object for which there will be a leading tag and the content will be included.
|
Sign1Message(boolean emitTag)
Create a signed message object.
|
Sign1Message(boolean emitTag,
boolean emitContent)
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 |
|---|---|
protected void |
DecodeFromCBORObject(com.upokecenter.cbor.CBORObject messageObject)
Internal function used in creating a Sign1Message object from a byte string.
|
protected com.upokecenter.cbor.CBORObject |
EncodeCBORObject()
Internal function used to create a serialization of a COSE_Sign1 message
|
void |
sign(com.upokecenter.cbor.CBORObject key)
Deprecated.
As of COSE 0.9.1, use sign(OneKey)
|
void |
sign(org.bouncycastle.crypto.CipherParameters key)
Create a signature for the message if one does not exist.
|
void |
sign(OneKey key)
Create a signature for the message if one does not exist.
|
boolean |
validate(com.upokecenter.cbor.CBORObject cnKey)
Deprecated.
As of COSE 0.9.1, use validate(OneKey)
|
boolean |
validate(org.bouncycastle.crypto.CipherParameters key)
Validate the signature on the message using the passed in key.
|
boolean |
validate(OneKey cnKey)
Validate the signature on the message using the passed in key.
|
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 Sign1Message()
public Sign1Message(boolean emitTag)
emitTag - emit leading tag when message is serializedpublic Sign1Message(boolean emitTag,
boolean emitContent)
emitTag - emit leading tag when message is serializedemitContent - emit the content as part of the messagepublic void sign(OneKey key) throws CoseException
key - key to use to sign the messageCoseException - Errors generated by the COSE module@Deprecated public void sign(com.upokecenter.cbor.CBORObject key) throws CoseException
key - key to use to sign the messageCoseException - Errors generated by the COSE modulepublic void sign(org.bouncycastle.crypto.CipherParameters key)
throws CoseException
key - key to use to sign the messageCoseException - Errors generated by the COSE module@Deprecated public boolean validate(com.upokecenter.cbor.CBORObject cnKey) throws CoseException
cnKey - key to use for validationCoseException - Errors generated by the COSE modulepublic boolean validate(OneKey cnKey) throws CoseException
cnKey - key to use for validationCoseException - Errors generated by the COSE modulepublic boolean validate(org.bouncycastle.crypto.CipherParameters key)
throws CoseException
key - key to use for validationCoseException - Errors generated by the COSE moduleprotected void DecodeFromCBORObject(com.upokecenter.cbor.CBORObject messageObject)
throws CoseException
DecodeFromCBORObject in class MessagemessageObject - COSE_Sign1 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 moduleCOSE for Java documentation, generatedin 2016.