tools

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinAbsPath

func BinAbsPath() string

func FileCreateAll

func FileCreateAll(file string) (*os.File, error)

FileCreateAll 创建文件,若目录不存在则创建,若文件存在则覆盖

func FileIsExist

func FileIsExist(path string) bool

FileIsExist 文件是否存在

func FileUserHome

func FileUserHome() string

FileUserHome 获取用户文件夹

func JsonParseStr

func JsonParseStr(jsonData string, obj interface{}) error

func JsonToStr

func JsonToStr(obj interface{}) (string, error)

func RSADecrypt

func RSADecrypt(privateKey *rsa.PrivateKey, ciphertext []byte) ([]byte, error)

RSADecrypt 使用私钥解密数据

func RSAEncrypt

func RSAEncrypt(publicKey *rsa.PublicKey, data []byte) ([]byte, error)

RSAEncrypt 使用公钥加密数据

func RSAGenerateKeys

func RSAGenerateKeys(bits int) (*rsa.PrivateKey, *rsa.PublicKey, error)

RSAGenerateKeys 生成RSA公私钥对,并返回私钥和公钥

func RSALoadPrivatePEMKey

func RSALoadPrivatePEMKey(fileName string) (*rsa.PrivateKey, error)

RSALoadPrivatePEMKey 从PEM文件中加载私钥

func RSALoadPublicPEMKey

func RSALoadPublicPEMKey(fileName string) (*rsa.PublicKey, error)

RSALoadPublicPEMKey 从PEM文件中加载公钥

func RSASavePrivatePEMKey

func RSASavePrivatePEMKey(filename string, key *rsa.PrivateKey) error

RSASavePrivatePEMKey 将私钥保存到文件中

func RSASavePublicPEMKey

func RSASavePublicPEMKey(filename string, pubkey *rsa.PublicKey) error

RSASavePublicPEMKey 将公钥保存到文件中

Types

This section is empty.

Jump to

Keyboard shortcuts

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