'Process a full part in the buffer.
We assume a complete part exists in self.buffer.
Raises:
IOError: if there is anything wrong with the data.'

def _ProcessPart(self):

    payload_data = self.buffer.getvalue()[self.header.DataStart:(self.header.DataStart + self.header.DataLength)]
    payload_hmac = self.buffer.getvalue()[self.header.HMACStart:(self.header.HMACStart + self.header.HMACLength)]
    if (self.cipher is None):
        if (self.header.PartType != PART_TYPE_ENCRYPTED_CIPHER):
            raise IOError('First    part    must    be    ENCRYPTED_CIPHER')
        signature = SignaturePart.FromSerializedString(payload_data)
        decrypted_cipher = self.readers_private_key.Decrypt(signature.encrypted_cipher)
        self.writers_public_key.Verify(decrypted_cipher, signature.signature)
        self.cipher_properties = flows.CipherProperties.FromSerializedString(decrypted_cipher)
        self.cipher = self.cipher_properties.GetCipher()
        self.hmac = self.cipher_properties.GetHMAC()
    elif (self.header.PartType == PART_TYPE_ENCRYPTED_DATA):
        plain_text = self.cipher.Decrypt(payload_data)
        self.outfd.write(plain_text)
    else:
        raise IOError(('Unsupported    part    type    %s' % self.header.PartType))
    try:
        self.hmac.Verify(payload_data, payload_hmac)
    except crypto.VerificationError:
        raise IOError('HMAC    not    verified')
    self.buffer.ReadFromFront(self.part_end)
    self.part_end = None
