rsa

package
v0.0.0-...-08fe5ed Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 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 {
	// PKCS1:  公钥使用  PKCS1 私钥使用 PKCS1
	// PKCS8:  公钥使用  PKCS1 私钥使用 PKCS8
	Type   string // 类型 PKCS1 / PKCS8
	Format string // 格式 pem

}

func GetInstance

func GetInstance(t string) *RSA

func (*RSA) Decrypt

func (r *RSA) Decrypt(data []byte, key []byte) ([]byte, error)

Decrypt 解密

func (*RSA) Encrypt

func (r *RSA) Encrypt(data string, key []byte) ([]byte, error)

Encrypt 加密

func (*RSA) GenerateKey

func (r *RSA) GenerateKey(bits int) ([]byte, []byte, error)

GenerateKey 生成公钥和私钥 要生成的密钥位数 1024 / 2048

func (*RSA) OAEPDecrypt

func (r *RSA) OAEPDecrypt(data []byte, key []byte, hash hash.Hash) ([]byte, error)

OAEPDecrypt OAEP 解密

func (*RSA) OAEPEncrypt

func (r *RSA) OAEPEncrypt(data string, key []byte, hash hash.Hash) ([]byte, error)

OAEPEncrypt OAEP 加密

Jump to

Keyboard shortcuts

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