fill_one_private_key (NMConnection *connection,
                      const char *pk_tag,
                      const char *pk_prop,
                      const char *cc_prop)
{
	const char *filename;
	NMSetting8021x *tmp;
	NMSetting8021xCKType pk_type = NM_SETTING_802_1X_CK_TYPE_UNKNOWN;
	gboolean need_client_cert = TRUE;

	/* If the private key is PKCS#12, don't set the client cert */
	filename = g_object_get_data (G_OBJECT (connection), pk_tag);
	if (!filename)
		return TRUE;

	tmp = NM_SETTING_802_1X (nm_setting_802_1x_new ());
	nm_setting_802_1x_set_private_key_from_file (tmp, filename, NULL, &pk_type, NULL);
	if (pk_type == NM_SETTING_802_1X_CK_TYPE_PKCS12) {
		GByteArray *array;

		array = file_to_g_byte_array (filename);
		if (array) {
			NMSetting *s_8021x = nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);

			g_object_set (s_8021x,
			              pk_prop, array,
			              cc_prop, array,
			              NULL);
			g_byte_array_free (array, TRUE);
			need_client_cert = FALSE;
		}
	}
	g_object_unref (tmp);
	return need_client_cert;
}
fill_one_private_key (NMConnection *connection,
                      const char *pk_tag,
                      const char *pk_prop,
                      const char *cc_prop)
{
	const char *filename;
	NMSetting8021x *tmp;
	NMSetting8021xCKType pk_type = NM_SETTING_802_1X_CK_TYPE_UNKNOWN;
	gboolean need_client_cert = TRUE;

	 
	filename = g_object_get_data (G_OBJECT (connection), pk_tag);
	if (!filename)
		return TRUE;

	tmp = NM_SETTING_802_1X (nm_setting_802_1x_new ());
	nm_setting_802_1x_set_private_key_from_file (tmp, filename, NULL, &pk_type, NULL);
	if (pk_type == NM_SETTING_802_1X_CK_TYPE_PKCS12) {
		GByteArray *array;

		array = file_to_g_byte_array (filename);
		if (array) {
			NMSetting *s_8021x = nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);

			g_object_set (s_8021x,
			              pk_prop, array,
			              cc_prop, array,
			              NULL);
			g_byte_array_free (array, TRUE);
			need_client_cert = FALSE;
		}
	}
	g_object_unref (tmp);
	return need_client_cert;
}