codec

package
v1.0.50 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2020 License: MIT Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPriKey    = errors.New("invalid private key")
	ErrInvalidPubKey    = errors.New("invalid public key")
	ErrPubKeyOutOfBound = errors.New("public key out of bound")
)
View Source
var (
	ErrPrivateKey = errors.New("private key error")
	ErrPublicKey  = errors.New("failed to parse PEM block containing the public key")
	ErrNotRsaKey  = errors.New("key type is not RSA")
)
View Source
var ErrPaddingSize = errors.New("padding size error")

Functions

func ComputeKey

func ComputeKey(pubKey, priKey *big.Int) (*big.Int, error)

func EcbDecrypt

func EcbDecrypt(key, src []byte) ([]byte, error)

func EcbDecryptBase64

func EcbDecryptBase64(key, src string) (string, error)

func EcbEncrypt

func EcbEncrypt(key, src []byte) ([]byte, error)

func EcbEncryptBase64

func EcbEncryptBase64(key, src string) (string, error)

func Gunzip

func Gunzip(bs []byte) ([]byte, error)

func Gzip

func Gzip(bs []byte) []byte

func Hmac

func Hmac(key []byte, body string) []byte

func HmacBase64

func HmacBase64(key []byte, body string) string

func NewECBDecrypter

func NewECBDecrypter(b cipher.Block) cipher.BlockMode

func NewECBEncrypter

func NewECBEncrypter(b cipher.Block) cipher.BlockMode

func NewPublicKey

func NewPublicKey(bs []byte) *big.Int

Types

type DhKey

type DhKey struct {
	PriKey *big.Int
	PubKey *big.Int
}

func GenerateKey

func GenerateKey() (*DhKey, error)

func (*DhKey) Bytes

func (k *DhKey) Bytes() []byte

type RsaDecrypter

type RsaDecrypter interface {
	Decrypt(input []byte) ([]byte, error)
	DecryptBase64(input string) ([]byte, error)
}

func NewRsaDecrypter

func NewRsaDecrypter(file string) (RsaDecrypter, error)

type RsaEncrypter

type RsaEncrypter interface {
	Encrypt(input []byte) ([]byte, error)
}

func NewRsaEncrypter

func NewRsaEncrypter(key []byte) (RsaEncrypter, error)

Jump to

Keyboard shortcuts

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