MCPcopy Create free account
hub / github.com/XTLS/Go / SetSessionTicketKeys

Method SetSessionTicketKeys

common.go:931–944  ·  view source on GitHub ↗

SetSessionTicketKeys updates the session ticket keys for a server. The first key will be used when creating new tickets, while all keys can be used for decrypting tickets. It is safe to call this function while the server is running in order to rotate the session ticket keys. The function will pani

(keys [][32]byte)

Source from the content-addressed store, hash-verified

929// previously recorded and future TLS connections using those keys might be
930// compromised.
931func (c *Config) SetSessionTicketKeys(keys [][32]byte) {
932 if len(keys) == 0 {
933 panic("tls: keys must have at least one key")
934 }
935
936 newKeys := make([]ticketKey, len(keys))
937 for i, bytes := range keys {
938 newKeys[i] = c.ticketKeyFromBytes(bytes)
939 }
940
941 c.mutex.Lock()
942 c.sessionTicketKeys = newKeys
943 c.mutex.Unlock()
944}
945
946func (c *Config) rand() io.Reader {
947 r := c.Rand

Callers

nothing calls this directly

Calls 1

ticketKeyFromBytesMethod · 0.95

Tested by

no test coverage detected