+ for base in ["id_%s" % suffix, "id_%s.pub" % suffix,
+ "authorized_keys"]]
+
+
+def GetAllUserFiles(user, mkdir=False, dircheck=True, _homedir_fn=None):
+ """Wrapper over L{GetUserFiles} to retrieve files for all SSH key types.
+
+ See L{GetUserFiles} for details.
+
+ @rtype: tuple; (string, dict with string as key, tuple of (string, string) as
+ value)
+
+ """
+ helper = compat.partial(GetUserFiles, user, mkdir=mkdir, dircheck=dircheck,
+ _homedir_fn=_homedir_fn)
+ result = [(kind, helper(kind=kind)) for kind in constants.SSHK_ALL]
+
+ authorized_keys = [i for (_, (_, _, i)) in result]
+
+ assert len(frozenset(authorized_keys)) == 1, \
+ "Different paths for authorized_keys were returned"
+
+ return (authorized_keys[0],
+ dict((kind, (privkey, pubkey))
+ for (kind, (privkey, pubkey, _)) in result))