dissector

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2024 License: MIT Imports: 6 Imported by: 0

README

tls-dissector

Dissect TLS handshake messages

Documentation

Index

Constants

View Source
const (
	ExtServerName           uint16 = 0x00
	ExtSupportedGroups      uint16 = 0x0a
	ExtECPointFormats       uint16 = 0x0b
	ExtSignatureAlgorithms  uint16 = 0x0d
	ExtEncryptThenMac       uint16 = 0x16
	ExtExtendedMasterSecret uint16 = 0x17
	ExtSessionTicket        uint16 = 0x23
	ExtRenegotiationInfo    uint16 = 0xff01
)
View Source
const (
	HelloRequest uint8 = 0
	ClientHello  uint8 = 1
	ServerHello  uint8 = 2
)
View Source
const (
	ChangeCipherSpec = 0x14
	EncryptedAlert   = 0x15
	Handshake        = 0x16
	AppData          = 0x17
)

record content type

View Source
const (
	RecordHeaderLen = 5
)

Variables

View Source
var (
	ErrShortBuffer  = errors.New("short buffer")
	ErrTypeMismatch = errors.New("type mismatch")
)
View Source
var (
	ErrBadType = errors.New("bad type")
)

Functions

This section is empty.

Types

type ClientHelloMsg

type ClientHelloMsg struct {
	Version            Version
	Random             Random
	SessionID          []byte
	CipherSuites       []uint16
	CompressionMethods []uint8
	Extensions         []Extension
}

func (*ClientHelloMsg) Decode

func (m *ClientHelloMsg) Decode(data []byte) (err error)

func (*ClientHelloMsg) Encode

func (m *ClientHelloMsg) Encode() (data []byte, err error)

func (*ClientHelloMsg) ReadFrom

func (m *ClientHelloMsg) ReadFrom(r io.Reader) (n int64, err error)

func (*ClientHelloMsg) WriteTo

func (m *ClientHelloMsg) WriteTo(w io.Writer) (n int64, err error)

type ECPointFormatsExtension

type ECPointFormatsExtension struct {
	Formats []uint8
}

func (*ECPointFormatsExtension) Decode

func (ext *ECPointFormatsExtension) Decode(b []byte) error

func (*ECPointFormatsExtension) Encode

func (ext *ECPointFormatsExtension) Encode() ([]byte, error)

func (*ECPointFormatsExtension) Type

func (ext *ECPointFormatsExtension) Type() uint16

type EncryptThenMacExtension

type EncryptThenMacExtension struct {
	Data []byte
}

func (*EncryptThenMacExtension) Decode

func (ext *EncryptThenMacExtension) Decode(b []byte) error

func (*EncryptThenMacExtension) Encode

func (ext *EncryptThenMacExtension) Encode() ([]byte, error)

func (*EncryptThenMacExtension) Type

func (ext *EncryptThenMacExtension) Type() uint16

type ExtendedMasterSecretExtension

type ExtendedMasterSecretExtension struct {
	Data []byte
}

func (*ExtendedMasterSecretExtension) Decode

func (ext *ExtendedMasterSecretExtension) Decode(b []byte) error

func (*ExtendedMasterSecretExtension) Encode

func (ext *ExtendedMasterSecretExtension) Encode() ([]byte, error)

func (*ExtendedMasterSecretExtension) Type

type Extension

type Extension interface {
	Type() uint16
	Encode() ([]byte, error)
	Decode([]byte) error
}

func NewExtension

func NewExtension(t uint16, data []byte) (ext Extension, err error)

func ReadExtension

func ReadExtension(r io.Reader) (Extension, error)

type Random

type Random struct {
	Time   uint32
	Opaque [28]byte
}

type Record

type Record struct {
	Type    uint8
	Version Version
	Opaque  []byte
}

func ReadRecord

func ReadRecord(r io.Reader) (*Record, error)

func (*Record) ReadFrom

func (rec *Record) ReadFrom(r io.Reader) (n int64, err error)

func (*Record) WriteTo

func (rec *Record) WriteTo(w io.Writer) (n int64, err error)

type RenegotiationInfoExtension

type RenegotiationInfoExtension struct {
	Data []byte
}

func (*RenegotiationInfoExtension) Decode

func (ext *RenegotiationInfoExtension) Decode(b []byte) error

func (*RenegotiationInfoExtension) Encode

func (ext *RenegotiationInfoExtension) Encode() ([]byte, error)

func (*RenegotiationInfoExtension) Type

func (ext *RenegotiationInfoExtension) Type() uint16

type ServerHelloMsg

type ServerHelloMsg struct {
	Version           Version
	Random            Random
	SessionID         []byte
	CipherSuite       uint16
	CompressionMethod uint8
	Extensions        []Extension
}

func (*ServerHelloMsg) Decode

func (m *ServerHelloMsg) Decode(data []byte) (err error)

func (*ServerHelloMsg) Encode

func (m *ServerHelloMsg) Encode() (data []byte, err error)

func (*ServerHelloMsg) ReadFrom

func (m *ServerHelloMsg) ReadFrom(r io.Reader) (n int64, err error)

func (*ServerHelloMsg) WriteTo

func (m *ServerHelloMsg) WriteTo(w io.Writer) (n int64, err error)

type ServerNameExtension

type ServerNameExtension struct {
	NameType uint8
	Name     string
}

func (*ServerNameExtension) Decode

func (ext *ServerNameExtension) Decode(b []byte) error

func (*ServerNameExtension) Encode

func (ext *ServerNameExtension) Encode() ([]byte, error)

func (*ServerNameExtension) Type

func (ext *ServerNameExtension) Type() uint16

type SessionTicketExtension

type SessionTicketExtension struct {
	Data []byte
}

func (*SessionTicketExtension) Decode

func (ext *SessionTicketExtension) Decode(b []byte) error

func (*SessionTicketExtension) Encode

func (ext *SessionTicketExtension) Encode() ([]byte, error)

func (*SessionTicketExtension) Type

func (ext *SessionTicketExtension) Type() uint16

type SignatureAlgorithmsExtension

type SignatureAlgorithmsExtension struct {
	Algorithms []uint16
}

func (*SignatureAlgorithmsExtension) Decode

func (ext *SignatureAlgorithmsExtension) Decode(b []byte) error

func (*SignatureAlgorithmsExtension) Encode

func (ext *SignatureAlgorithmsExtension) Encode() ([]byte, error)

func (*SignatureAlgorithmsExtension) Type

type SupportedGroupsExtension

type SupportedGroupsExtension struct {
	Groups []uint16
}

func (*SupportedGroupsExtension) Decode

func (ext *SupportedGroupsExtension) Decode(b []byte) error

func (*SupportedGroupsExtension) Encode

func (ext *SupportedGroupsExtension) Encode() ([]byte, error)

func (*SupportedGroupsExtension) Type

func (ext *SupportedGroupsExtension) Type() uint16

type Version

type Version uint16

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL