

def read(self):
    'Read the next string from the pipe.\n\n        The expected data format is:  4-byte size, data, signature\n        '
    self.check_connection()
    sz = self._read(4)
    if (len(sz) < 4):
        raise EOFError
    sz = struct.unpack('I', sz)[0]
    data = self._read(sz)
    if (len(data) < sz):
        raise EOFError
    sig = self._read(self._read_hmac.digest_size)
    self._read_hmac.update(data)
    if (sig != self._read_hmac.digest()):
        self.close()
        raise RuntimeError('mismatched hmac; terminating')
    return data

dataset/ETHPy150Open cloudmatrix/esky/esky/sudo/sudo_base.py SecureStringPipe.read/original