rsa

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyPair

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

KeyPair RSA 密钥对

func GenerateKeyPair

func GenerateKeyPair(bits int) (*KeyPair, []byte, []byte, error)

GenerateKeyPair 生成 RSA 密钥对

func NewKeyPair

func NewKeyPair(privateKeyPEM, publicKeyPEM []byte) (*KeyPair, error)

NewKeyPair 从 PEM 格式的密钥数据创建 KeyPair

func (*KeyPair) Decrypt

func (kp *KeyPair) Decrypt(src string, usePrivate bool) ([]byte, error)

Decrypt 使用公钥或私钥解密数据

func (*KeyPair) DecryptPrivate

func (kp *KeyPair) DecryptPrivate(src string) ([]byte, error)

DecryptPrivate 使用私钥解密数据

func (*KeyPair) DecryptPublic

func (kp *KeyPair) DecryptPublic(src string) ([]byte, error)

DecryptPublic 使用公钥解密数据

func (*KeyPair) Encrypt

func (kp *KeyPair) Encrypt(src []byte, usePublic bool) (string, error)

Encrypt 使用公钥或私钥加密数据

func (*KeyPair) EncryptPrivate

func (kp *KeyPair) EncryptPrivate(src []byte) (string, error)

EncryptPrivate 使用私钥加密数据

func (*KeyPair) EncryptPublic

func (kp *KeyPair) EncryptPublic(src []byte) (string, error)

EncryptPublic 使用公钥加密数据

Jump to

Keyboard shortcuts

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