crypto

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(crypted, key []byte) ([]byte, error)

Aes对称解密

func AesDecryptSimple

func AesDecryptSimple(cipherText string, key string) string

Aes对称解密(简单版本)

func AesEncrypt

func AesEncrypt(origData, key []byte) ([]byte, error)

Aes对称加密

func AesEncryptSimple

func AesEncryptSimple(plainText string, key string) string

Aes对称加密(简单版本)

func DesDecrypt

func DesDecrypt(decrypted string, key []byte) (string, error)

Des对称解密

func DesEncrypt

func DesEncrypt(text string, key []byte) (string, error)

Des对称加密

func ToBase64

func ToBase64(rsc []byte) string

Types

type RSA

type RSA struct {
	Length                RsaLength //RSA长度
	PrivateKey, PublicKey []byte    //私钥公钥
}

func NewGenRSA

func NewGenRSA(length RsaLength) *RSA

RSA公钥私钥产生

func NewRSA

func NewRSA(PrvKey, PubKey []byte) *RSA

func (*RSA) RsaDecrypt

func (p *RSA) RsaDecrypt(ciphertext []byte) []byte

私钥解密

func (*RSA) RsaEncrypt

func (p *RSA) RsaEncrypt(data []byte) []byte

公钥加密

func (*RSA) RsaSignWithSha256

func (p *RSA) RsaSignWithSha256(data []byte) []byte

私钥签名

func (*RSA) RsaVerySignWithSha256

func (p *RSA) RsaVerySignWithSha256(data, signData []byte) bool

公钥验签

type RsaLength

type RsaLength int

RSA长度

const (
	LEN_1024 RsaLength = 1024
	LEN_2048 RsaLength = 2048
)

Jump to

Keyboard shortcuts

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