Returns a dict containing details of a certificate request.

    :depends:   - OpenSSL command line tool

    csr:
        A path or PEM encoded string containing the CSR to read.

    CLI Example:

    .. code-block:: bash

        salt '*' x509.read_csr /etc/pki/mycert.csr

def read_csr(csr):
    '''
    Returns a dict containing details of a certificate request.

    :depends:   - OpenSSL command line tool

    csr:
        A path or PEM encoded string containing the CSR to read.

    CLI Example:

    .. code-block:: bash

        salt '*' x509.read_csr /etc/pki/mycert.csr
    '''
    csr = _get_request_obj(csr)
    ret = {
        # X509 Version 3 has a value of 2 in the field.
        # Version 2 has a value of 1.
        # https://tools.ietf.org/html/rfc5280#section-4.1.2.1
        'Version': csr.get_version() + 1,
        # Get size returns in bytes. The world thinks of key sizes in bits.
        'Subject': _parse_subject(csr.get_subject()),
        'Subject Hash': _dec2hex(csr.get_subject().as_hash()),
        'Public Key Hash': hashlib.sha1(csr.get_pubkey().get_modulus()).hexdigest(),
        'X509v3 Extensions': _get_csr_extensions(csr),
    }

    return ret