.. versionadded:: 2017.7.0

    List known repo key details.

    :return: A dictionary containing the repo keys.
    :rtype: dict

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.get_repo_keys

def get_repo_keys():
    '''
    .. versionadded:: 2017.7.0

    List known repo key details.

    :return: A dictionary containing the repo keys.
    :rtype: dict

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.get_repo_keys
    '''
    ret = dict()
    repo_keys = list()

    # The double usage of '--with-fingerprint' is necessary in order to
    # retrieve the fingerprint of the subkey.
    cmd = ['apt-key', 'adv', '--batch', '--list-public-keys', '--with-fingerprint',
           '--with-fingerprint', '--with-colons', '--fixed-list-mode']

    cmd_ret = _call_apt(cmd, scope=False)

    if cmd_ret['retcode'] != 0:
        log.error(cmd_ret['stderr'])
        return ret

    lines = [line for line in cmd_ret['stdout'].splitlines() if line.strip()]

    # Reference for the meaning of each item in the colon-separated
    # record can be found here: https://goo.gl/KIZbvp
    for line in lines:
        items = [_convert_if_int(item.strip()) if item.strip() else None for item in line.split(':')]
        key_props = dict()

        if len(items) < 2:
            log.debug('Skipping line: %s', line)
            continue

        if items[0] in ('pub', 'sub'):
            key_props.update({
                'algorithm': items[3],
                'bits': items[2],
                'capability': items[11],
                'date_creation': items[5],
                'date_expiration': items[6],
                'keyid': items[4],
                'validity': items[1]
            })

            if items[0] == 'pub':
                repo_keys.append(key_props)
            else:
                repo_keys[-1]['subkey'] = key_props
        elif items[0] == 'fpr':
            if repo_keys[-1].get('subkey', False):
                repo_keys[-1]['subkey'].update({'fingerprint': items[9]})
            else:
                repo_keys[-1].update({'fingerprint': items[9]})
        elif items[0] == 'uid':
            repo_keys[-1].update({
                'uid': items[9],
                'uid_hash': items[7]
            })

    for repo_key in repo_keys:
        ret[repo_key['keyid']] = repo_key
    return ret