crypto

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder interface {
	Decode([]byte) ([]byte, error)
}

Decoder 解密

type Des3Encoding

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

Des3Encoding 加解密

func NewDes3Encoding

func NewDes3Encoding(des3key string) *Des3Encoding

NewDes3Encoding 新建加密解密对象

func (*Des3Encoding) Decode

func (h *Des3Encoding) Decode(b []byte) ([]byte, error)

Decode 实现解密接口

func (*Des3Encoding) Encode

func (h *Des3Encoding) Encode(b []byte) ([]byte, error)

Encode 实现加密功能

type Encoder

type Encoder interface {
	Encode([]byte) ([]byte, error)
}

Encoder 加密

type RsaDecoder

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

RsaDecoder RSA 解密器

func NewRsaDecoder

func NewRsaDecoder(privKey []byte) (*RsaDecoder, error)

NewRsaDecoder 新建 RSA 解密器

func (*RsaDecoder) Decode

func (r *RsaDecoder) Decode(b []byte) ([]byte, error)

Decode 解密

type RsaEncoder

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

RsaEncoder RSA 加密器

func NewRsaEncoder

func NewRsaEncoder(publicKey []byte) (*RsaEncoder, error)

NewRsaEncoder 新建 RSA 加密器

func (*RsaEncoder) Encode

func (r *RsaEncoder) Encode(data []byte) ([]byte, error)

Encode 加密

type SignVerifier

type SignVerifier interface {
	Verify(mess, timestamp, data, sign string) (bool, error)
}

SignVerifier 验签

func NewHmacSignVerifier

func NewHmacSignVerifier(appKey string) (SignVerifier, error)

NewHmacSignVerifier 新建 HMAC 验签

func NewRsaSignVerifier

func NewRsaSignVerifier(publicKey, appKey string) (SignVerifier, error)

NewRsaSignVerifier 新建 RSA 签名验证

type Signer

type Signer interface {
	Sign(mess, timestamp, data string) (string, error)
}

Signer 签名

func NewHmacSigner

func NewHmacSigner(appKey string) (Signer, error)

NewHmacSigner 新建 HMAC 签名

func NewRsaSigner

func NewRsaSigner(privateKey, appkey string) (Signer, error)

NewRsaSigner 新建 RSA 签名

Jump to

Keyboard shortcuts

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