rsaKit

package
v1.30.16 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package rsaKit 对私钥进行"加密"、"解密"操作. *

Package rsaKit 支持长文本加解密 *

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultPublicKey 默认公钥
	DefaultPublicKey []byte

	// DefaultPrivateKey 默认私钥
	DefaultPrivateKey []byte

	// DefaultPassword 默认私钥的密码
	DefaultPassword = []byte("Y3l5")
)

Functions

func Decrypt

func Decrypt(privateKey, password, data []byte) ([]byte, error)

Decrypt 私钥解密 *

  • @param password 私钥的密码,可以为nil

func DecryptPEM

func DecryptPEM(pemRaw []byte, passwd []byte) ([]byte, error)

DecryptPEM 通过password,解密私钥 *

  • decrypt a pem private key
  • input: pem raw
  • output: pem raw

func DecryptToString

func DecryptToString(privateKeyData, password, data []byte) (string, error)

DecryptToString *

  • @param password 私钥的密码,可以为nil

func Encrypt

func Encrypt(publicKey []byte, data []byte) ([]byte, error)

Encrypt 公钥加密

func EncryptPEM

func EncryptPEM(pemRaw []byte, passwd []byte) ([]byte, error)

EncryptPEM 通过password,加密私钥 *

  • encrypt a pem private key
  • input: pem raw
  • output: pem raw

func EncryptToString

func EncryptToString(publicKeyData []byte, data []byte) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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