opendkim

package module
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2019 License: BSD-3-Clause Imports: 8 Imported by: 0

README

opendkim

libopendkim wrapper for Go

Documentation

Index

Constants

View Source
const (
	StatusOK            = 0  // function completed successfully
	StatusBADSIG        = 1  // signature available but failed
	StatusNOSIG         = 2  // no signature available
	StatusNOKEY         = 3  // public key not found
	StatusCANTVRFY      = 4  // can't get domain key to verify
	StatusSYNTAX        = 5  // message is not valid syntax
	StatusNORESOURCE    = 6  // resource unavailable
	StatusINTERNAL      = 7  // internal error
	StatusREVOKED       = 8  // key found, but revoked
	StatusINVALID       = 9  // invalid function parameter
	StatusNOTIMPLEMENT  = 10 // function not implemented
	StatusKEYFAIL       = 11 // key retrieval failed
	StatusCBREJECT      = 12 // callback requested reject
	StatusCBINVALID     = 13 // callback gave invalid result
	StatusCBTRYAGAIN    = 14 // callback says try again later
	StatusCBERROR       = 15 // callback error
	StatusMULTIDNSREPLY = 16 // multiple DNS replies
	StatusSIGGEN        = 17 // signature generation failed
)
View Source
const (
	LibflagsNONE          = 0x0000
	LibflagsTMPFILES      = 0x0001
	LibflagsKEEPFILES     = 0x0002
	LibflagsSIGNLEN       = 0x0004
	LibflagsCACHE         = 0x0008
	LibflagsZTAGS         = 0x0010
	LibflagsDELAYSIGPROC  = 0x0020
	LibflagsEOHCHECK      = 0x0040
	LibflagsACCEPTV05     = 0x0080
	LibflagsFIXCRLF       = 0x0100
	LibflagsACCEPTDK      = 0x0200
	LibflagsBADSIGHANDLES = 0x0400
	LibflagsVERIFYONE     = 0x0800
	LibflagsSTRICTHDRS    = 0x1000
	LibflagsREPORTBADADSP = 0x2000
	LibflagsDROPSIGNER    = 0x4000
	LibflagsSTRICTRESIGN  = 0x8000
)
View Source
const (
	SigflagIGNORE      = 0x01
	SigflagPROCESSED   = 0x02
	SigflagPASSED      = 0x04
	SigflagTESTKEY     = 0x08
	SigflagNOSUBDOMAIN = 0x10
	SigflagKEYLOADED   = 0x20
)
View Source
const (
	QueryUNKNOWN = (-1) // unknown method
	QueryDNS     = 0    // DNS query method (per the draft)
	QueryFILE    = 1    // text file method (for testing)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Canon

type Canon int
const (
	CanonUNKNOWN Canon = (-1) // unknown method
	CanonSIMPLE  Canon = 0    // as specified in DKIM spec
	CanonRELAXED Canon = 1    // as specified in DKIM spec
)

type Dkim

type Dkim struct {
	// contains filtered or unexported fields
}

Dkim handle

func (*Dkim) Body

func (d *Dkim) Body(data []byte) Status

Body processes the message body.

func (*Dkim) Destroy

func (d *Dkim) Destroy() Status

Destroy destroys the dkim handle.

func (*Dkim) Eoh

func (d *Dkim) Eoh() Status

Eoh is called to signal end of header.

func (*Dkim) Eom

func (d *Dkim) Eom(testKey *bool) Status

Eom is called to signal end of message.

func (*Dkim) GetError

func (d *Dkim) GetError() string

GetError gets the last error for the dkim handle

func (*Dkim) GetSigHdr

func (d *Dkim) GetSigHdr(buf []byte) ([]byte, Status)

func (*Dkim) GetSignature

func (d *Dkim) GetSignature() *Signature

GetSignature returns the signature. Eom must be called before invoking GetSignature.

func (*Dkim) Header

func (d *Dkim) Header(line string) Status

Header processes a single header line. May be invoked multiple times.

func (*Dkim) Sign

func (d *Dkim) Sign(r io.Reader) ([]byte, error)

Sign is a helper method for signing a block of message data. The message data includes header and body.

func (*Dkim) Verify

func (d *Dkim) Verify(r io.Reader) Status

Verify is a helper method for verifying a message in one step

type Lib

type Lib struct {
	// contains filtered or unexported fields
}

Lib is a dkim library handle

func Init

func Init() *Lib

Init inits a new dkim library handle

func (*Lib) Close

func (lib *Lib) Close() error

Close closes the dkim lib

func (*Lib) NewSigner

func (lib *Lib) NewSigner(secret, selector, domain string, hdrCanon, bodyCanon Canon, algo Sign, bytesToSign int64) (*Dkim, Status)

NewSigner creates a new DKIM handle for message signing. If -1 is specified for bytesToSign, the whole message body will be signed.

func (*Lib) NewVerifier

func (lib *Lib) NewVerifier() (*Dkim, Status)

NewVerifier creates a new DKIM verifier

func (*Lib) Options

func (lib *Lib) Options(op Op, opt Option, ptr unsafe.Pointer, size uintptr) Status

Options sets or gets library options

type Op

type Op int
const (
	GetOpt Op = 0
	SetOpt Op = 1
)

type Option

type Option int
const (
	OptionFLAGS        Option = 0
	OptionTMPDIR       Option = 1
	OptionTIMEOUT      Option = 2
	OptionSENDERHDRS   Option = 3
	OptionSIGNHDRS     Option = 4
	OptionOVERSIGNHDRS Option = 5
	OptionQUERYMETHOD  Option = 6
	OptionQUERYINFO    Option = 7
	OptionFIXEDTIME    Option = 8
	OptionSKIPHDRS     Option = 9
	OptionALWAYSHDRS   Option = 10 // obsolete
	OptionSIGNATURETTL Option = 11
	OptionCLOCKDRIFT   Option = 12
	OptionMUSTBESIGNED Option = 13
	OptionMINKEYBITS   Option = 14
	OptionREQUIREDHDRS Option = 15
)

type Sigflag

type Sigflag uint

type Sign

type Sign int
const (
	SignUNKNOWN   Sign = -2 // unknown method
	SignDEFAULT   Sign = -1 // use internal default
	SignRSASHA1   Sign = 0  // an RSA-signed SHA1 digest
	SignRSASHA256 Sign = 1  // an RSA-signed SHA256 digest
)

type Signature

type Signature struct {
	// contains filtered or unexported fields
}

Signature is a DKIM signature

func (*Signature) Flags

func (s *Signature) Flags() Sigflag

Flags returns the signature flags

func (*Signature) Process

func (s *Signature) Process() Status

Process processes a signature for validity.

type Status

type Status int

func (Status) Error

func (s Status) Error() string

func (Status) IsOk added in v1.1.6

func (s Status) IsOk() bool

func (Status) String

func (s Status) String() string

Jump to

Keyboard shortcuts

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