code: private void setupKey(OneKey key) throws CoseException {
          CBORObject cn2;
          CBORObject cn;
          
          cnKey = key;
  
          if (rgbSignature != null) return;
          
          cn = key.get(KeyKeys.Algorithm);
          if (cn != null) {
              cn2 = findAttribute(HeaderKeys.Algorithm);
              if (cn2 == null) addAttribute(HeaderKeys.Algorithm, cn, Attribute.PROTECTED);
          }
          
          cn = key.get(KeyKeys.KeyId);
          if (cn != null) {
              cn2 = findAttribute(HeaderKeys.KID);
              if (cn2 == null) addAttribute(HeaderKeys.KID, cn, Attribute.UNPROTECTED);
          }
      }
docs: Set the key on the object, if there is not a signature on this object then set
  the algorithm and the key id from the key if they exist on the key and do not exist in the message.
  
  @param key key to be used]