coding

package
v0.0.0-...-fc9fbc1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64UrlDecoding

func Base64UrlDecoding(src string) ([]byte, error)

Base64URL解码

func Base64UrlEncoding

func Base64UrlEncoding(src string) string

用于URL参数传输时的编解码,如果要用在url中,需要使用URLEncoding

func DecodeBase64FromString

func DecodeBase64FromString(data string) ([]byte, error)

base64字符串解码

func DecodeHex

func DecodeHex(dst, src []byte) (int, error)

将src解码为DecodedLen(len(src))字节,返回实际写入dst的字节数;如遇到非法字符,返回描述错误的error。

func DecodeHexFromString

func DecodeHexFromString(hexStr string) ([]byte, error)

返回hex编码的字符串hexStr解码的数据,入参字符串需事先被hex编码过

func EncodeBase64ToString

func EncodeBase64ToString(src string) string

base64字符串编码

func EncodeHex

func EncodeHex(dst, src []byte) int

将src的数据编码为EncodedLen(len(src))字节,返回实际写入dst的字节数:EncodedLen(len(src))。

func EncodeHexToString

func EncodeHexToString(src []byte) string

返回十六进制字符编码成的字符串

func GenECCPemKeyFile

func GenECCPemKeyFile(privateKey *ecdsa.PrivateKey, pemKeyPath string) error

序列化rsa公私钥并保存为pem文件 @param privateKey *ecdsa.PrivateKey 使用ecdsa中的GenerateKey方法生成私钥值 @param pemKeyPath string pem公私钥文件的保存路径

func GenRSAPemKeyFile

func GenRSAPemKeyFile(privateKey *rsa.PrivateKey, pemKeyPath string) error

序列化rsa公私钥并保存为pem文件 @param privateKey *rsa.PrivateKey 使用rsa中的GenerateKey方法生成私钥值 @param pemKeyPath string pem公私钥文件的保存路径

func ParseECCPrivatePemKey

func ParseECCPrivatePemKey(privateKeyFile string) (privateKey *ecdsa.PrivateKey, err error)

获取私钥文件

func ParseECCPublicPemKey

func ParseECCPublicPemKey(publicKeyFile string) (publicKey *ecdsa.PublicKey, err error)

解析公钥文件

func ParseRSAPrivatePemKey

func ParseRSAPrivatePemKey(privateKeyFile string) (privateKey *rsa.PrivateKey, err error)

解析RSA私钥文件

func ParseRSAPublicPemKey

func ParseRSAPublicPemKey(publicKeyFile string) (publicKey *rsa.PublicKey, err error)

解析RSA公钥文件

Types

This section is empty.

Jump to

Keyboard shortcuts

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