public class Signer extends Attribute
Create a Signer object for adding a new signature to a message, existing signers will have a Signer object created for them when a SignMessage object is created by Message.DecodeFromBytes.
Examples of using this class can be found in
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 String |
contextString |
protected byte[] |
rgbSignature |
DO_NOT_SEND, DontSendAttributes, externalData, objDontSend, objProtected, objUnprotected, PROTECTED, ProtectedAttributes, rgbProtected, UNPROTECTED, UnprotectedAttributes| Constructor and Description |
|---|
Signer()
Create a new signer object to add to a SignMessage
|
Signer(OneKey key)
Create a new signer object for a SignMessage and set the key to be used.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCountersignature(CounterSign countersignature) |
void |
clearKey()
Remove the key object from the signer
|
protected void |
DecodeFromCBORObject(com.upokecenter.cbor.CBORObject obj)
Internal function used in creating a Sign1Message object from a byte string.
|
protected com.upokecenter.cbor.CBORObject |
EncodeToCBORObject()
Internal function used to create a serialization of a COSE_Sign1 message
|
CounterSign1 |
getCountersign1() |
List<CounterSign> |
getCountersignerList() |
protected void |
ProcessCounterSignatures() |
void |
setCountersign1(CounterSign1 value) |
void |
setKey(OneKey keyIn)
Set a key object on a signer
|
void |
sign(byte[] rgbBodyProtected,
byte[] rgbContent) |
boolean |
validate(byte[] rgbBodyProtected,
byte[] rgbContent) |
boolean |
validate(CounterSign countersignature) |
boolean |
validate(CounterSign1 countersignature) |
addAttribute, addAttribute, addAttribute, AddProtected, AddProtected, AddProtected, AddUnprotected, AddUnprotected, AddUnprotected, findAttribute, findAttribute, findAttribute, findAttribute, getDoNotSendAttributes, getExternal, getProtectedAttributes, getUnprotectedAttributes, removeAttribute, removeAttribute, setExternalprotected byte[] rgbSignature
protected String contextString
public Signer()
public Signer(OneKey key)
key - key to use for signing.public void clearKey()
public void setKey(OneKey keyIn) throws CoseException
keyIn - key to be used for signing or verificationCoseException - - Invalid key passed inprotected void DecodeFromCBORObject(com.upokecenter.cbor.CBORObject obj)
throws CoseException
obj - COSE_Sign1 encoded object.CoseException - Errors generated by the COSE moduleprotected com.upokecenter.cbor.CBORObject EncodeToCBORObject()
throws CoseException
CoseException - Errors generated by the COSE modulepublic void sign(byte[] rgbBodyProtected,
byte[] rgbContent)
throws CoseException
CoseExceptionpublic boolean validate(byte[] rgbBodyProtected,
byte[] rgbContent)
throws CoseException
CoseExceptionpublic void addCountersignature(CounterSign countersignature)
public List<CounterSign> getCountersignerList()
public CounterSign1 getCountersign1()
public void setCountersign1(CounterSign1 value)
protected void ProcessCounterSignatures()
throws CoseException
CoseExceptionpublic boolean validate(CounterSign1 countersignature) throws CoseException
CoseExceptionpublic boolean validate(CounterSign countersignature) throws CoseException
CoseExceptionCOSE for Java documentation, generatedin 2019.