Package COSE

Class Signer

  • Direct Known Subclasses:
    CounterSign, CounterSign1

    public class Signer
    extends Attribute
    The Signer class is used to implement the COSE_Signer object. This provides the information dealing with a single signature for the SignMessage class.

    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.

    Author:
    jimsch
    • Field Detail

      • rgbSignature

        protected byte[] rgbSignature
      • contextString

        protected String contextString
    • Constructor Detail

      • Signer

        public Signer()
        Create a new signer object to add to a SignMessage
      • Signer

        public Signer​(OneKey key)
        Create a new signer object for a SignMessage and set the key to be used.
        Parameters:
        key - key to use for signing.
    • Method Detail

      • clearKey

        public void clearKey()
        Remove the key object from the signer
        Since:
        COSE 0.9.1
      • setKey

        public void setKey​(OneKey keyIn)
                    throws CoseException
        Set a key object on a signer
        Parameters:
        keyIn - key to be used for signing or verification
        Throws:
        CoseException - - Invalid key passed in
        Since:
        COSE 0.9.1
      • DecodeFromCBORObject

        protected void DecodeFromCBORObject​(com.upokecenter.cbor.CBORObject obj)
                                     throws CoseException
        Internal function used in creating a Sign1Message object from a byte string.
        Parameters:
        obj - COSE_Sign1 encoded object.
        Throws:
        CoseException - Errors generated by the COSE module
      • EncodeToCBORObject

        protected com.upokecenter.cbor.CBORObject EncodeToCBORObject()
                                                              throws CoseException
        Internal function used to create a serialization of a COSE_Sign1 message
        Returns:
        CBOR object which can be encoded.
        Throws:
        CoseException - Errors generated by the COSE module
      • addCountersignature

        public void addCountersignature​(CounterSign countersignature)
      • setCountersign1

        public void setCountersign1​(CounterSign1 value)