ccache
import "github.com/TheManticoreProject/Manticore/network/kerberos/v5/credcache/ccache"
Package ccache reads and writes the MIT Kerberos FILE credential cache (KRB5CCNAME) in format version 4, the interchange format used by Linux Kerberos tooling. Version 4 is big-endian throughout and is documented at https://web.mit.edu/kerberos/krb5-latest/doc/formats/ccache_file_format.html.
Layout: a two-byte version tag (0x05 0x04), a tagged header, the default client principal, then a sequence of credential entries running to EOF (no count, no terminator). This package implements the wire format; building entries from a live TGT/ST is done by the client layer.
Index
Constants
Version4 is the file_format_version this package reads and writes.
const Version4 = 0x0504
type Address
Address is a host address entry.
type Address struct {
AddrType uint16
Data []byte
}
type AuthData
AuthData is an authorization-data entry.
type AuthData struct {
ADType uint16
Data []byte
}
type CCache
CCache is a parsed credential cache.
type CCache struct {
// DeltaTime is the optional KDC time offset (seconds, microseconds). Zero
// means no delta-time header field is written.
DeltaTimeSecs uint32
DeltaTimeUsecs uint32
DefaultPrincipal Principal
Credentials []Credential
}
func Load
func Load(path string) (*CCache, error)
Load reads and parses a ccache file.
func Unmarshal
func Unmarshal(data []byte) (*CCache, error)
Unmarshal parses a ccache. Only format version 4 is supported.
func (*CCache) Marshal
func (cc *CCache) Marshal() ([]byte, error)
Marshal encodes the cache in ccache format version 4.
func (*CCache) Save
func (cc *CCache) Save(path string) error
Save writes the cache to path in ccache v4 format, mode 0600.
type Credential
Credential is one cached ticket. Times are Unix seconds (uint32) as stored on the wire; TicketFlags uses the RFC 4120 ticket-flag bit layout (bit 0 = MSB).
type Credential struct {
Client Principal
Server Principal
Key Keyblock
AuthTime uint32
StartTime uint32
EndTime uint32
RenewTill uint32
IsSKey bool
TicketFlags uint32
Addresses []Address
AuthData []AuthData
Ticket []byte
SecondTicket []byte
}
type Keyblock
Keyblock is a session key with its encryption type.
type Keyblock struct {
EType uint16
KeyValue []byte
}
type Principal
Principal is a cache principal (client or server).
type Principal struct {
NameType uint32
Realm string
Components []string
}