cipher

package
v1.0.9 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: 0

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