util

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptWithPrivateKey

func DecryptWithPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) ([]byte, error)

DecryptWithPrivateKey decrypts data with private key

func EncryptWithPublicKey

func EncryptWithPublicKey(msg []byte, pub *rsa.PublicKey) ([]byte, error)

EncryptWithPublicKey encrypts data with public key

func GetBufferPool

func GetBufferPool() *bytes.Buffer

func GetStringsBuilder

func GetStringsBuilder() *strings.Builder

func GetUrlValues

func GetUrlValues() url.Values

func JSONMarshal

func JSONMarshal(req interface{}) []byte

JSONMarshal encode json without html escape

func ParsePrivateKeyFromPem

func ParsePrivateKeyFromPem(bs []byte) (*rsa.PrivateKey, error)

func ParsePublicKeyFromPem

func ParsePublicKeyFromPem(bs []byte) (*rsa.PublicKey, error)

ParsePublicKeyFromPem read public key from pem file

func PutBufferPool

func PutBufferPool(buf *bytes.Buffer)

func PutStringsBuilder

func PutStringsBuilder(b *strings.Builder)

func PutUrlValues

func PutUrlValues(vals url.Values)

func ReadPrivateKeyFromPem

func ReadPrivateKeyFromPem(r io.Reader) (*rsa.PrivateKey, error)

ReadPrivateKeyFromPem read private key from pem file

func ReadPublicKeyFromPem

func ReadPublicKeyFromPem(r io.Reader) (*rsa.PublicKey, error)

ReadPublicKeyFromPem read public key from pem file

func SignWithPrivateKey

func SignWithPrivateKey(msg []byte, privKey *rsa.PrivateKey) ([]byte, error)

SignWithPrivateKey sign data with private key

func StringsJoin

func StringsJoin(strs ...string) string

func VerifyWithPublicKey

func VerifyWithPublicKey(msg []byte, signature []byte, pubKey *rsa.PublicKey) error

VerifyWithPublicKey sign data with private key

func WritePrivateKeyPem

func WritePrivateKeyPem(w io.Writer, privKey *rsa.PrivateKey) error

WritePrivateKeyPem write private key to pem file

func WritePublicKeyPem

func WritePublicKeyPem(w io.Writer, pubKey *rsa.PublicKey) error

WritePublicKeyPem write public key to pem file

Types

This section is empty.

Directories

Path Synopsis
Package query encode struct to url.Values
Package query encode struct to url.Values

Jump to

Keyboard shortcuts

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