def make_gpg_home(appname, config_dir=None):
    """
    Make GPG keyring dir for a particular application.
    Return the path.
    """

    assert is_valid_appname(appname)
    config_dir = get_config_dir( config_dir )
    path = os.path.join( config_dir, "gpgkeys", appname )

    if not os.path.exists(path):
        os.makedirs( path, 0700 )
    else:
        os.chmod( path, 0700 )

    return path