crypto

package
v0.0.0-...-2c5f5e2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(cryted string, key string) string

func AesEncrypt

func AesEncrypt(orig string, key string) string

func MD5

func MD5(i interface{}) string

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blocksize int) []byte

补码

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

去码

Types

type Rsa

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

func NewRsa

func NewRsa(publicKey, privateKey string) *Rsa

func (*Rsa) CreateKeys

func (r *Rsa) CreateKeys(keyLength int) (privateKey, publicKey string)

*

  • 生成pkcs1格式公钥私钥

func (*Rsa) CreatePkcs8Keys

func (r *Rsa) CreatePkcs8Keys(keyLength int) (privateKey, publicKey string)

*

  • 生成pkcs8格式公钥私钥

func (*Rsa) Decrypt

func (r *Rsa) Decrypt(secretData []byte) ([]byte, error)

*

  • 解密

func (*Rsa) Encrypt

func (r *Rsa) Encrypt(data []byte) ([]byte, error)

*

  • 加密

func (*Rsa) MarshalPKCS8PrivateKey

func (r *Rsa) MarshalPKCS8PrivateKey(key *rsa.PrivateKey) []byte

func (*Rsa) Sign

func (r *Rsa) Sign(data []byte, algorithmSign crypto.Hash) ([]byte, error)

*

  • 签名

func (*Rsa) Verify

func (r *Rsa) Verify(data []byte, sign []byte, algorithmSign crypto.Hash) bool

*

  • 验签

type Serializable

type Serializable interface {
	Serialize() []byte
}

Jump to

Keyboard shortcuts

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