cipher

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: BSD-3-Clause Imports: 18 Imported by: ? modules, 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

This section is empty.

Functions

func LoadRSAPrivateKey

func LoadRSAPrivateKey(pemFile string) (*rsa.PrivateKey, error)

解析私钥文件

func LoadRSAPublicKey

func LoadRSAPublicKey(pemFile string) (*rsa.PublicKey, error)

解析公钥文件

func MaxEncryptSize

func MaxEncryptSize(pubkey *rsa.PublicKey) int

最大加密内容大小

func RSADecrypt

func RSADecrypt(privkey *rsa.PrivateKey, data []byte) ([]byte, error)

func RSAEncrypt

func RSAEncrypt(pubkey *rsa.PublicKey, data []byte) ([]byte, error)

Types

type BlockCryptor

type BlockCryptor interface {
	Encrypt(src []byte) []byte
	Decrypt(src []byte) []byte
}

func NewAESCFB

func NewAESCFB(key, iv []byte) BlockCryptor

key should be 16, 24, or 32 bytes

func NewCrypt

func NewCrypt(name string, key, iv []byte) BlockCryptor

func NewNoneCrypt

func NewNoneCrypt(key, iv []byte) BlockCryptor

func NewSM4

func NewSM4(key, iv []byte) BlockCryptor

key must be 16-byte

func NewSalsa20

func NewSalsa20(key, nonce []byte) BlockCryptor

func NewTripleDES

func NewTripleDES(key, iv []byte) BlockCryptor

key must be 24-byte

func NewTwofish

func NewTwofish(key, iv []byte) BlockCryptor

key should be 16, 24 or 32 bytes

func NewXTEA

func NewXTEA(key, iv []byte) BlockCryptor

key must be 16 bytes

Jump to

Keyboard shortcuts

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