'Build the master key from header settings and key-hash list.
Start reading from `stream` after the header and decrypt all the data.
Remove padding as needed and feed into hashed block reader, set as
in-buffer.'

def _decrypt(self, stream):

    super(KDB4File, self)._decrypt(stream)
    data = aes_cbc_decrypt(stream.read(), self.master_key, self.header.EncryptionIV)
    data = unpad(data)
    length = len(self.header.StreamStartBytes)
    if (self.header.StreamStartBytes == data[:length]):
        self.in_buffer = HashedBlockIO(bytes=data[length:])
        self.opened = True
    else:
        raise IOError('Master    key    invalid.')
