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)
| 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. |
| 767 | func (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. |
no test coverage detected