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)
| 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. |
| 316 | func (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 | |
| 325 | func (c *Config) encryptTicket(state []byte, ticketKeys []ticketKey) ([]byte, error) { |
| 326 | if len(ticketKeys) == 0 { |
nothing calls this directly
no test coverage detected