def to_binary(key = nil, jwe = nil)
      if not key.nil?
        jwe ||= kty.key_encryptor(fields, key)
      end
      if key and jwe
        return to_map(key, jwe).compact
      else
        return JOSE.encode(to_map)
      end
    end
def to_binary(key = nil, jwe = nil)
      if not key.nil?
        jwe ||= kty.key_encryptor(fields, key)
      end
      if key and jwe
        return to_map(key, jwe).compact
      else
        return JOSE.encode(to_map)
      end
    end
Converts a {JOSE::JWK JOSE::JWK} into a binary.

 @param [String] key
 @param [JOSE::JWE] jwe
 @return [String, JOSE::EncryptedBinary]