utils

package
v0.0.0-...-5df1752 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PKCS1 int64 = iota
	PKCS8

	// 私钥 PEMBEGIN 开头
	PEMBEGIN = "-----BEGIN RSA PRIVATE KEY-----\n"
	// 私钥 PEMEND 结尾
	PEMEND = "\n-----END RSA PRIVATE KEY-----"
	// 公钥 PEMBEGIN 开头
	PUBPEMBEGIN = "-----BEGIN PUBLIC KEY-----\n"
	// 公钥 PEMEND 结尾
	PUBPEMEND = "\n-----END PUBLIC KEY-----"
)

Variables

This section is empty.

Functions

func AppendFile

func AppendFile(fileName string, content []byte) bool

追加数据

func CheckFileExist

func CheckFileExist(filePath string) bool

func CreateDir

func CreateDir(filePath string) bool

func FormatPublicKey

func FormatPublicKey(publicKey string) string

FormatPublicKey 组装公钥

func Md5

func Md5(s string) string

func Md5Array

func Md5Array(params ...string) string

主程序的GetSign

func ParsePublicKey

func ParsePublicKey(publicKey string) (*rsa.PublicKey, error)

func ReadFile

func ReadFile(filePath string) []byte

func Rsa2PubSign

func Rsa2PubSign(publicKey, signContent, sign string) error

func RsaSha256

func RsaSha256(privateRaw string, msg string) (string, error)

func WriteFile

func WriteFile(fileName string, content []byte) bool

Types

type HttpResp

type HttpResp struct {
	Err        error
	Data       []byte
	Localtion  string
	RequestUrl string
}

func HttpGet

func HttpGet(api string) HttpResp

func HttpGetWithHeader

func HttpGetWithHeader(api string, h map[string]string) HttpResp

func HttpPostForm

func HttpPostForm(api string, data url.Values) HttpResp

func HttpPostJson

func HttpPostJson(api string, param interface{}) HttpResp

func HttpPostJsonAndHeader

func HttpPostJsonAndHeader(api string, header map[string]string, param interface{}) HttpResp

Jump to

Keyboard shortcuts

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