rsa

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKeys

func CreateKeys(keyLength int) (privateKey, publicKey string)

*

  • 生成pkcs1格式公钥私钥

func CreatePkcs8Keys

func CreatePkcs8Keys(keyLength int) (privateKey, publicKey string)

*

  • 生成pkcs8格式公钥私钥

func MarshalPKCS8PrivateKey

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

Types

type Rsa

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

func NewRsa

func NewRsa(publicKey, privateKey string) (r *Rsa, err error)

func (*Rsa) Decrypt

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

*

  • 解密

func (*Rsa) Encrypt

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

*

  • 加密

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

*

  • 验签

Jump to

Keyboard shortcuts

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