rsa

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RSA

type RSA struct {
	PublicKey  *rsa.PublicKey
	PrivateKey *rsa.PrivateKey
}

func Init

func Init(bits int) (RSA, error)

Init 初始化秘钥对

func InitWithKey

func InitWithKey(public []byte, private []byte) (RSA, error)

InitWithKey 初始化秘钥对

func (*RSA) Decrypt

func (f *RSA) Decrypt(data []byte) []byte

Decrypt rsa私钥加密 data 要解密的数据

func (*RSA) Encrypt

func (f *RSA) Encrypt(data []byte) []byte

Encrypt rsa公钥加密 data 要加密的数据

func (*RSA) GenerateKey

func (f *RSA) GenerateKey(bits int) error

GenerateKey RsaGenKey 参数bits: 指定生成的秘钥的长度, 单位: bit

func (*RSA) SavePem

func (f *RSA) SavePem() error

SavePem 保存公钥私钥文件

func (*RSA) Sign

func (f *RSA) Sign(data []byte) []byte

Sign rsa私钥签名 data 要签名的数据

func (*RSA) Verify

func (f *RSA) Verify(data []byte, signature []byte) error

Verify rsa公钥验签 data 要验签的数据

Jump to

Keyboard shortcuts

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