def to_map(key = nil, jwe = nil)
      if not key.nil?
        jwe ||= kty.key_encryptor(fields, key)
      end
      if key and jwe
        return JOSE::JWE.block_encrypt(key, to_binary, jwe)
      elsif kty.nil? and keys
        return keys.to_map(fields)
      else
        return kty.to_map(fields)
      end
    end
def to_map(key = nil, jwe = nil)
      if not key.nil?
        jwe ||= kty.key_encryptor(fields, key)
      end
      if key and jwe
        return JOSE::JWE.block_encrypt(key, to_binary, jwe)
      elsif kty.nil? and keys
        return keys.to_map(fields)
      else
        return kty.to_map(fields)
      end
    end
Converts a {JOSE::JWK JOSE::JWK} into a map.

 @param [String] key
 @param [JOSE::JWE] jwe
 @return [JOSE::Map]