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

Method ticketKeyFromBytes

common.go:767–774  ·  view source on GitHub ↗

ticketKeyFromBytes converts from the external representation of a session ticket key to a ticketKey. Externally, session ticket keys are 32 random bytes and this function expands that into sufficient name and key material.

(b [32]byte)

Source from the content-addressed store, hash-verified

765// ticket key to a ticketKey. Externally, session ticket keys are 32 random
766// bytes and this function expands that into sufficient name and key material.
767func (c *Config) ticketKeyFromBytes(b [32]byte) (key ticketKey) {
768 hashed := sha512.Sum512(b[:])
769 copy(key.keyName[:], hashed[:ticketKeyNameLen])
770 copy(key.aesKey[:], hashed[ticketKeyNameLen:ticketKeyNameLen+16])
771 copy(key.hmacKey[:], hashed[ticketKeyNameLen+16:ticketKeyNameLen+32])
772 key.created = c.time()
773 return key
774}
775
776// maxSessionTicketLifetime is the maximum allowed lifetime of a TLS 1.3 session
777// ticket, and the lifetime we set for tickets we send.

Callers 3

ticketKeysMethod · 0.95
SetSessionTicketKeysMethod · 0.95

Calls 1

timeMethod · 0.95

Tested by

no test coverage detected