encryption

package
v0.0.0-...-f2c4183 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2017 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEncryptionList

func GetEncryptionList() []string

func RegisterEncryption

func RegisterEncryption(name string, action EncryptionAction) error

Types

type EncryptionAction

type EncryptionAction interface {
	//InitUser,连接代理服务器后进行的初始化操作
	//conn:服务器的连接套接字
	//param:配置文件里面填写的EncryptionParam
	InitUser(conn net.Conn, param string) error

	//Encrypt,加密
	//data:源数据
	//输出 加密后的数据 与 一个error(若发生了错误)
	Encrypt(data []byte) ([]byte, error)

	//Decrypt,解密
	//data:加密数据
	//输出 解密后的数据 与 一个error(若发生了错误)
	Decrypt(data []byte) ([]byte, error)
}

func GetEncryption

func GetEncryption(name string) (EncryptionAction, bool)

type KeypairAes

type KeypairAes struct {
	Key   []byte
	Block cipher.Block
}

func (*KeypairAes) Decrypt

func (this *KeypairAes) Decrypt(data []byte) ([]byte, error)

func (*KeypairAes) Encrypt

func (this *KeypairAes) Encrypt(data []byte) ([]byte, error)

func (*KeypairAes) GenBytes

func (this *KeypairAes) GenBytes(bytesLen int) []byte

func (*KeypairAes) InitUser

func (this *KeypairAes) InitUser(conn net.Conn, param string) error

func (*KeypairAes) SafeRead

func (this *KeypairAes) SafeRead(conn net.Conn, length int) ([]byte, error)

func (*KeypairAes) StrPadding

func (this *KeypairAes) StrPadding(str string) string

type PskAes256Cfb

type PskAes256Cfb struct {
	Key   []byte
	Block cipher.Block
}

func (*PskAes256Cfb) Decrypt

func (this *PskAes256Cfb) Decrypt(data []byte) ([]byte, error)

func (*PskAes256Cfb) Encrypt

func (this *PskAes256Cfb) Encrypt(data []byte) ([]byte, error)

func (*PskAes256Cfb) InitUser

func (this *PskAes256Cfb) InitUser(conn net.Conn, param string) error

type PskAesCfb

type PskAesCfb struct {
	Key   []byte
	Block cipher.Block
}

func (*PskAesCfb) Decrypt

func (this *PskAesCfb) Decrypt(data []byte) ([]byte, error)

func (*PskAesCfb) Encrypt

func (this *PskAesCfb) Encrypt(data []byte) ([]byte, error)

func (*PskAesCfb) InitUser

func (this *PskAesCfb) InitUser(conn net.Conn, param string) error

type PskRc4Md5

type PskRc4Md5 struct {
	Cipher *rc4.Cipher
}

func (*PskRc4Md5) Decrypt

func (this *PskRc4Md5) Decrypt(data []byte) ([]byte, error)

func (*PskRc4Md5) Encrypt

func (this *PskRc4Md5) Encrypt(data []byte) ([]byte, error)

func (*PskRc4Md5) InitUser

func (this *PskRc4Md5) InitUser(conn net.Conn, param string) error

Jump to

Keyboard shortcuts

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