digest

package
v0.0.0-...-843ee25 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_CHALLENGE_LENGTH = 2048
	MAX_RESPONSE_LENGTH  = 4096
	DEFAULT_MAXBUF       = 65536
)
View Source
const (
	DES3 = iota
	RC4
	DES
	RC4_56
	RC4_40
)

Supported ciphers for 'auth-conf'

View Source
const (
	DES_3_STRENGTH        = sasl.HIGH_STRENGTH
	RC4_STRENGTH          = sasl.HIGH_STRENGTH
	DES_STRENGTH          = sasl.MEDIUM_STRENGTH
	RC4_56_STRENGTH       = sasl.MEDIUM_STRENGTH
	RC4_40_STRENGTH       = sasl.LOW_STRENGTH
	UNSET                 = byte(0)
	SECURITY_LAYER_MARKER = ":00000000000000000000000000000000"
)

If QOP is set to 'auth-conf', a DIGEST-MD5 mechanism must have support for the DES and Triple DES cipher algorithms (optionally, support for RC4 [128/56/40 bit keys] ciphers) to provide for confidentiality. See RFC 2831 for details. This implementation provides support for DES, Triple DES and RC4 ciphers.

The value of strength effects the strength of cipher used. The mappings of 'high', 'medium', and 'low' give the following behaviour.

HIGH_STRENGTH   - Triple DES
                - RC4 (128bit)
MEDIUM_STRENGTH - DES
                - RC4 (56bit)
LOW_SRENGTH     - RC4 (40bit)
View Source
const (
	CLIENT_INT_MAGIC  = "golang sasl integrity client-to-server magic key"
	SVR_INT_MAGIC     = "golang sasl integrity server-to-client magic key"
	CLIENT_CONF_MAGIC = "Digest H(A1) to client-to-server sealing key magic constant"
	SVR_CONF_MAGIC    = "Digest H(A1) to server-to-client sealing key magic constant"
)

Variables

View Source
var (
	CIPHER_MASKS    = []byte{DES_3_STRENGTH, RC4_STRENGTH, DES_3_STRENGTH, RC4_56_STRENGTH, RC4_40_STRENGTH}
	CIPHER_TOKENS   = []string{"3des", "rc4", "des", "rc4-56", "rc4-40"}
	JCE_CIPHER_NAME = []string{"DESede/CBC/NoPadding", "RC4", "DES/CBC/NoPadding"}
)
View Source
var (
	EMPTY_BYTE_SLICE = make([]byte, 0)
)

Functions

This section is empty.

Types

type Integrity

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

Integrity is a implementation of the SecurityCtx interface allowing for messages between the client and server to be integrity checked. After a successful DIGEST-MD5 authentication, integrity checking is invoked if the SASL QOP is set to 'auth-int'.

func NewIntegrity

func NewIntegrity(clientMode bool) (*Integrity, error)

NewIntegrity create a new instance of Integrity

func (*Integrity) GetHMac

func (i *Integrity) GetHMac(ki, seqnum, msg []byte, start, msgLen int) ([]byte, error)

GetHMac generates MAC to be appended onto out-going messages.

func (*Integrity) IncrementSeqNum

func (i *Integrity) IncrementSeqNum()

IncrementSeqNum increment own sequence number and set answer in NBO sequenceNum field.

func (*Integrity) Unwrap

func (i *Integrity) Unwrap(incoming []byte, start, msgLen int) ([]byte, error)

Unwrap return verified message without MAC - only if the received MAC and re-generated MAC are the same

func (*Integrity) Wrap

func (i *Integrity) Wrap(outgoing []byte, start, msgLen int) ([]byte, error)

Wrap append MAC onto outgoing message

type MD5Base

type MD5Base struct {
	*sasl.Sasl
	// contains filtered or unexported fields
}

MD5Base is a utility class for DIGEST-MD5 mechanism. Provides utility methods and contains two inner classes which implement the SecurityCtx interface. The inner classes provide the funtionality to allow for quality-of-protection (QOP) with integrity checking and privacy.

type Privacy

type Privacy struct {
	*Integrity
	// contains filtered or unexported fields
}

Privacy is implementation of the SecurityCtx interface allowing for messages between the client and server to be integrity checked and encrypted. After a successful DIGEST-MD5 authentication, privacy is invoked if the SASL QOP (quality-of-protection) is set to 'auth-conf'.

func NewPrivacy

func NewPrivacy(clientMode bool) (*Privacy, error)

NewPrivacy create a new Privacy instance for privacy check

type SecurityCtx

type SecurityCtx interface {
	// Wrap out-going message and return wrapped message
	Wrap(dest []byte, start, len int) ([]byte, error)

	// Unwrap incoming message and return original message
	Unwrap(outgoing []byte, start, len int) ([]byte, error)
}

SecurityCtx is an interface used for classes implementing integrity checking and privacy for DIGEST-MD5 SASL mechanism implementation.

Jump to

Keyboard shortcuts

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