MCPcopy
hub / github.com/XTLS/REALITY / EncryptTicket

Method EncryptTicket

ticket.go:316–323  ·  view source on GitHub ↗

EncryptTicket encrypts a ticket with the [Config]'s configured (or default) session ticket keys. It can be used as a [Config.WrapSession] implementation.

(cs ConnectionState, ss *SessionState)

Source from the content-addressed store, hash-verified

314// EncryptTicket encrypts a ticket with the [Config]'s configured (or default)
315// session ticket keys. It can be used as a [Config.WrapSession] implementation.
316func (c *Config) EncryptTicket(cs ConnectionState, ss *SessionState) ([]byte, error) {
317 ticketKeys := c.ticketKeys(nil)
318 stateBytes, err := ss.Bytes()
319 if err != nil {
320 return nil, err
321 }
322 return c.encryptTicket(stateBytes, ticketKeys)
323}
324
325func (c *Config) encryptTicket(state []byte, ticketKeys []ticketKey) ([]byte, error) {
326 if len(ticketKeys) == 0 {

Callers

nothing calls this directly

Calls 3

ticketKeysMethod · 0.95
encryptTicketMethod · 0.95
BytesMethod · 0.80

Tested by

no test coverage detected