'Decrypt data with ECIES method using the local private key'

def decrypt(self, data, ciphername='aes-256-cbc'):

    blocksize = OpenSSL.get_cipher(ciphername).get_blocksize()
    iv = data[:blocksize]
    i = blocksize
    (curve, pubkey_x, pubkey_y, i2) = ECC._decode_pubkey(data[i:])
    i += i2
    ciphertext = data[i:(len(data) - 32)]
    i += len(ciphertext)
    mac = data[i:]
    key = sha512(self.raw_get_ecdh_key(pubkey_x, pubkey_y)).digest()
    (key_e, key_m) = (key[:32], key[32:])
    if (not equals(hmac_sha256(key_m, data[:(len(data) - 32)]), mac)):
        raise RuntimeError('Fail    to    verify    data')
    ctx = Cipher(key_e, iv, 0, ciphername)
    return ctx.ciphering(ciphertext)
