code: public void sign(OneKey key) throws CoseException {
          if (rgbContent == null) throw new CoseException("No Content Specified");
          if (rgbSignature != null) return;
  
          if (rgbProtected == null) {
              if (objProtected.size() > 0) rgbProtected = objProtected.EncodeToBytes();
              else rgbProtected = new byte[0];
          }
                  
          CBORObject obj = CBORObject.NewArray();
          obj.Add(contextString);
          obj.Add(rgbProtected);
          obj.Add(externalData);
          obj.Add(rgbContent);
          
          rgbSignature = computeSignature(obj.EncodeToBytes(), key);
          
          ProcessCounterSignatures();
      }
docs: Create a signature for the message if one does not exist.
  
  @param key key to use to sign the message
  @exception CoseException Errors generated by the COSE module