Add a default key-directory parameter to the function that can be returned if there is no keystore, or if the keystore directory is NULL (the latter is also true for the built-in keystore).