crypto

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EtypeAESSHA2 etype = 1
	EtypeRC4MD5  etype = 2
)

Functions

func MakeSeqNum

func MakeSeqNum(ctx context.Context, seqNum uint64, client bool) []byte

Types

type AESSHA2

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

func (*AESSHA2) DeriveKey

func (c *AESSHA2) DeriveKey(ctx context.Context, key []byte) []byte

func (*AESSHA2) MICHeader

func (c *AESSHA2) MICHeader(ctx context.Context, seqNum uint64) []byte

func (*AESSHA2) MakeSignature

func (c *AESSHA2) MakeSignature(ctx context.Context, seqNum uint64, forSign [][]byte) ([]byte, error)

func (*AESSHA2) Size

func (c *AESSHA2) Size(ctx context.Context, conf bool) int

func (*AESSHA2) Unwrap

func (c *AESSHA2) Unwrap(ctx context.Context, seqNum uint64, forSign, forSeal [][]byte, sgn []byte) ([]byte, error)

func (*AESSHA2) Wrap

func (c *AESSHA2) Wrap(ctx context.Context, seqNum uint64, forSign [][]byte, forSeal [][]byte) ([]byte, error)

func (*AESSHA2) WrapHeader

func (c *AESSHA2) WrapHeader(ctx context.Context, seqNum uint64) []byte

type Cipher

type Cipher interface {
	Size(context.Context, bool) int
	Wrap(context.Context, uint64, [][]byte, [][]byte) ([]byte, error)
	Unwrap(context.Context, uint64, [][]byte, [][]byte, []byte) ([]byte, error)
	MakeSignature(context.Context, uint64, [][]byte) ([]byte, error)
}

func NewCipher

func NewCipher(ctx context.Context, etype etype, key []byte, isClient bool) Cipher

type RC4MD5

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

func (*RC4MD5) EncryptionKey

func (c *RC4MD5) EncryptionKey(ctx context.Context, seqNum uint64) ([]byte, error)

func (*RC4MD5) MICHeader

func (c *RC4MD5) MICHeader(ctx context.Context, seqNum uint64) []byte

func (*RC4MD5) MakeSignature

func (c *RC4MD5) MakeSignature(ctx context.Context, seqNum uint64, forSign [][]byte) ([]byte, error)

func (*RC4MD5) Size

func (c *RC4MD5) Size(ctx context.Context, conf bool) int

func (*RC4MD5) Unwrap

func (c *RC4MD5) Unwrap(ctx context.Context, seqNum uint64, forSign, forSeal [][]byte, sgn []byte) ([]byte, error)

func (*RC4MD5) Wrap

func (c *RC4MD5) Wrap(ctx context.Context, seqNum uint64, forSign, forSeal [][]byte) ([]byte, error)

func (*RC4MD5) WrapHeader

func (c *RC4MD5) WrapHeader(ctx context.Context, seqNum uint64) []byte

Jump to

Keyboard shortcuts

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