from io import StringIO


def _unpack(bytes):
    """Unpack C{bytes} into a digest, keyInfo, iv, and a payload.

    @return: a 4-tuple of digest, keyInfo, iv, and payload.
    """
    buffer = StringIO(bytes)
    digest = buffer.read(20)
    keyInfo = buffer.read(4)
    iv = buffer.read(16)
    payload = buffer.read()
    return digest, keyInfo, iv, payload