Documentation ¶
Index ¶
- func DecryptWithPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) ([]byte, error)
- func EncryptWithPublicKey(msg []byte, pub *rsa.PublicKey) ([]byte, error)
- func JSONMarshal(req interface{}) []byte
- func Md5String(req string) string
- func NewBufferPool() *bytes.Buffer
- func NewStringsBuilder() *strings.Builder
- func NewUrlValues() url.Values
- func ParsePrivateKeyFromPem(bs []byte) (*rsa.PrivateKey, error)
- func ParsePublicKeyFromPem(bs []byte) (*rsa.PublicKey, error)
- func ReadPrivateKeyFromPem(r io.Reader) (*rsa.PrivateKey, error)
- func ReadPublicKeyFromPem(r io.Reader) (*rsa.PublicKey, error)
- func ReleaseBufferPool(buf *bytes.Buffer)
- func ReleaseStringsBuilder(b *strings.Builder)
- func ReleaseUrlValues(vals url.Values)
- func SignWithPrivateKey(msg []byte, privKey *rsa.PrivateKey) ([]byte, error)
- func StringsJoin(strs ...string) string
- func VerifyWithPublicKey(msg []byte, signature []byte, pubKey *rsa.PublicKey) error
- func WritePrivateKeyPem(w io.Writer, privKey *rsa.PrivateKey) error
- func WritePublicKeyPem(w io.Writer, pubKey *rsa.PublicKey) error
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 ¶
EncryptWithPublicKey encrypts data with public key
func JSONMarshal ¶
func JSONMarshal(req interface{}) []byte
JSONMarshal encode json without html escape
func NewBufferPool ¶ added in v1.0.2
func NewStringsBuilder ¶ added in v1.0.2
func NewUrlValues ¶ added in v1.0.2
func ParsePrivateKeyFromPem ¶
func ParsePrivateKeyFromPem(bs []byte) (*rsa.PrivateKey, error)
func ParsePublicKeyFromPem ¶
ParsePublicKeyFromPem read public key from pem file
func ReadPrivateKeyFromPem ¶
func ReadPrivateKeyFromPem(r io.Reader) (*rsa.PrivateKey, error)
ReadPrivateKeyFromPem read private key from pem file
func ReadPublicKeyFromPem ¶
ReadPublicKeyFromPem read public key from pem file
func ReleaseBufferPool ¶ added in v1.0.2
func ReleaseStringsBuilder ¶ added in v1.0.2
func ReleaseUrlValues ¶ added in v1.0.2
func SignWithPrivateKey ¶
func SignWithPrivateKey(msg []byte, privKey *rsa.PrivateKey) ([]byte, error)
SignWithPrivateKey sign data with private key
func StringsJoin ¶
func VerifyWithPublicKey ¶
VerifyWithPublicKey sign data with private key
func WritePrivateKeyPem ¶
func WritePrivateKeyPem(w io.Writer, privKey *rsa.PrivateKey) error
WritePrivateKeyPem write private key to pem file
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.