'Produce the PKCS#1 v1.5 signature of a message.
This function is named ``RSASSA-PKCS1-V1_5-SIGN``, and is specified in
section 8.2.1 of RFC3447.
:Parameters:
mhash : hash object
The hash that was carried out over the message. This is an object
belonging to the `Crypto.Hash` module.
:Return: The signature encoded as a string.
:Raise ValueError:
If the RSA key length is not sufficiently long to deal with the given
hash algorithm.
:Raise TypeError:
If the RSA key has no private half.'

def sign(self, mhash):

    modBits = Crypto.Util.number.size(self._key.n)
    k = ceil_div(modBits, 8)
    em = EMSA_PKCS1_V1_5_ENCODE(mhash, k)
    m = self._key.decrypt(em)
    S = ((bchr(0) * (k - len(m))) + m)
    return S
