'Extract and verify a potential session ticket.
The given `data\' is treated as a session ticket.  The ticket is being
decrypted and authenticated (yes, in that order).  If all these steps
succeed, `True\' is returned.  Otherwise, `False\' is returned.'

def receiveTicket(self, data):

    if (len(data) < ((const.TICKET_LENGTH + const.MARK_LENGTH) + const.HMAC_SHA256_128_LENGTH)):
        return False
    potentialTicket = data.peek()
    if (not self.decryptedTicket):
        newTicket = ticket.decrypt(potentialTicket[:const.TICKET_LENGTH], self.srvState)
        if ((newTicket != None) and newTicket.isValid()):
            self.deriveSecrets(newTicket.masterKey)
            self.decryptedTicket = True
        else:
            return False
    mark = mycrypto.HMAC_SHA256_128(self.recvHMAC, potentialTicket[:const.TICKET_LENGTH])
    index = util.locateMark(mark, potentialTicket)
    if (not index):
        return False
    existingHMAC = potentialTicket[(index + const.MARK_LENGTH):((index + const.MARK_LENGTH) + const.HMAC_SHA256_128_LENGTH)]
    authenticated = False
    for epoch in util.expandedEpoch():
        myHMAC = mycrypto.HMAC_SHA256_128(self.recvHMAC, (potentialTicket[0:(index + const.MARK_LENGTH)] + epoch))
        if util.isValidHMAC(myHMAC, existingHMAC, self.recvHMAC):
            authenticated = True
            break
    if (not authenticated):
        return False
    if self.srvState.isReplayed(existingHMAC):
        return False
    data.drain(((index + const.MARK_LENGTH) + const.HMAC_SHA256_128_LENGTH))
    self.srvState.registerKey(existingHMAC)
    self.protoState = const.ST_CONNECTED
    return True
