wwcrypt

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Signature

func Signature(token, timestamp, nonce, enc string) string

Types

type AES

type AES struct {
	Duplicate bool
	// contains filtered or unexported fields
}

AES Helper

func NewAESFromEncodeKey

func NewAESFromEncodeKey(base64Key string) (c *AES, err error)

NewAESFromEncodeKey create from base64 encode key

func NewAESFromKey

func NewAESFromKey(key []byte) (c *AES, err error)

NewAESFromKey create from raw key

func (AES) Decrypt

func (c AES) Decrypt(bytes []byte) []byte

Decrypt with strip

func (AES) Encrypt

func (c AES) Encrypt(bytes []byte) []byte

Encrypt with padding

type Crypto

type Crypto struct {
	ReceiveID      string
	Token          string
	EncodingAESKey string
	// contains filtered or unexported fields
}

func (*Crypto) Decrypt

func (c *Crypto) Decrypt(in []byte) (out []byte, err error)

func (*Crypto) DecryptMessage

func (c *Crypto) DecryptMessage(enc []byte) ([]byte, error)

func (*Crypto) Encrypt

func (c *Crypto) Encrypt(in []byte) (out []byte, err error)

func (*Crypto) EncryptMessage

func (c *Crypto) EncryptMessage(dec []byte) (enc []byte, err error)

func (*Crypto) GetAESKey

func (c *Crypto) GetAESKey() (key []byte, err error)

func (*Crypto) GetDecrypter

func (c *Crypto) GetDecrypter() (cipher.BlockMode, error)

func (*Crypto) GetEncrypter

func (c *Crypto) GetEncrypter() (cipher.BlockMode, error)

func (*Crypto) Reset

func (c *Crypto) Reset()

func (*Crypto) Signature

func (c *Crypto) Signature(timestamp, nonce, enc string) string

func (*Crypto) Verify

func (c *Crypto) Verify(signature, timestamp, nonce, echo string) ([]byte, error)

type ReceiveContent

type ReceiveContent struct {
	ReceiverID string
	Content    []byte
}

func DecryptContent

func DecryptContent(encodingAESKey string, enc []byte) (msg *ReceiveContent, err error)

func (*ReceiveContent) MarshalBinary

func (rc *ReceiveContent) MarshalBinary() (data []byte, err error)

func (*ReceiveContent) UnmarshalBinary

func (rc *ReceiveContent) UnmarshalBinary(data []byte) (err error)

func (*ReceiveContent) VerifyReceiverID

func (rc *ReceiveContent) VerifyReceiverID(r string) bool

type ReceiveMessage

type ReceiveMessage struct {
	ToUsername string          `xml:"ToUserName"`
	Encrypt    string          `xml:"Encrypt"`
	AgentID    string          `xml:"AgentID"`
	Content    *ReceiveContent `xml:"-"`
}

func DecryptMessage

func DecryptMessage(encodingAESKey string, post []byte) (msg *ReceiveMessage, err error)

Jump to

Keyboard shortcuts

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