'Returns a ready-to-use session ticket after prior initialisation.
After the `SessionTicket()\' class was initialised with a master key,
this method encrypts and authenticates the protocol state and returns
the final result which is ready to be sent over the wire.'

def issue(self):

    self.state.issueDate = int(time.time())
    aes = AES.new(self.symmTicketKey, mode=AES.MODE_CBC, IV=self.IV)
    state = repr(self.state)
    assert ((len(state) % AES.block_size) == 0)
    cryptedState = aes.encrypt(state)
    hmac = HMAC.new(self.hmacTicketKey, (self.IV + cryptedState), digestmod=SHA256).digest()
    finalTicket = ((self.IV + cryptedState) + hmac)
    log.debug(('Returning    %d-byte    ticket.' % len(finalTicket)))
    return finalTicket
