tsig

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyFileParse = fmt.Errorf("keyfile parse error")

Functions

This section is empty.

Types

type HmacType

type HmacType string
const (
	HmacSHA1   HmacType = "hmac-sha1"
	HmacSHA224 HmacType = "hmac-sha224"
	HmacSHA256 HmacType = "hmac-sha256"
	HmacSHA384 HmacType = "hmac-sha384"
	HmacSHA512 HmacType = "hmac-sha512"
)

func (HmacType) BlockSize

func (h HmacType) BlockSize() int

func (HmacType) String

func (h HmacType) String() string

func (HmacType) Sum

func (h HmacType) Sum(key, data []byte) []byte

type Key

type Key struct {
	Host      string
	Algorithm HmacType
	Secret    []byte
}

func GenerateKey

func GenerateKey(host string, algorithm HmacType) (*Key, error)

func KeyFromBase64

func KeyFromBase64(host string, algorithm HmacType, secret string) (*Key, error)

func KeyFromBytes

func KeyFromBytes(host string, algorithm HmacType, secret []byte) (*Key, error)

func Parse

func Parse(r io.Reader) (kfs []*Key, err error)

func (*Key) Generate

func (k *Key) Generate(msg []byte, t *dns.TSIG) ([]byte, error)

Generate is passed the DNS message to be signed and the partial TSIG RR. It returns the signature and nil, otherwise an error.

func (*Key) Verify

func (k *Key) Verify(msg []byte, t *dns.TSIG) error

Verify is passed the DNS message to be verified and the TSIG RR. If the signature is valid it will return nil, otherwise an error.

type UnsupportedAlgorithmError

type UnsupportedAlgorithmError struct {
	Value string
}

func (*UnsupportedAlgorithmError) Error

func (e *UnsupportedAlgorithmError) Error() string

Jump to

Keyboard shortcuts

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