'Provides the signed digest we should have given this key and signature.
:param str signing_key: key block used to make this signature
:param str signature: signed digest for this descriptor content
:returns: the digest string encoded in uppercase hex
:raises: ValueError if unable to provide a validly signed digest'

def _digest_for_signature(self, signing_key, signature):

    if (not stem.prereq.is_crypto_available()):
        raise ValueError('Generating    the    signed    digest    requires    pycrypto')
    from Crypto.Util import asn1
    from Crypto.Util.number import bytes_to_long, long_to_bytes
    seq = asn1.DerSequence()
    seq.decode(_bytes_for_block(signing_key))
    (modulus, public_exponent) = (seq[0], seq[1])
    sig_as_bytes = _bytes_for_block(signature)
    sig_as_long = bytes_to_long(sig_as_bytes)
    blocksize = 128
    decrypted_int = pow(sig_as_long, public_exponent, modulus)
    decrypted_bytes = long_to_bytes(decrypted_int, blocksize)
    try:
        if (decrypted_bytes.index('\x00\x01') != 0):
            raise ValueError('Verification    failed,    identifier    missing')
    except ValueError:
        raise ValueError('Verification    failed,    malformed    data')
    try:
        identifier_offset = 2
        seperator_index = decrypted_bytes.index('\x00', identifier_offset)
    except ValueError:
        raise ValueError('Verification    failed,    seperator    not    found')
    digest_hex = codecs.encode(decrypted_bytes[(seperator_index + 1):], 'hex_codec')
    return stem.util.str_tools._to_unicode(digest_hex.upper())
