core: Split up keyfile processing for config

Into a separate function, so it can be used to load from data instead.

https://bugzilla.gnome.org/show_bug.cgi?id=722358