security

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HmacSHA1

func HmacSHA1(data, key string) string

func ImportPrivateKey

func ImportPrivateKey(pkstr string) (*rsa.PrivateKey, error)

func ImportPublicKey

func ImportPublicKey(pubKey string) (*rsa.PublicKey, error)

func MD5

func MD5(v string) string

func RSADecrypt

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

RSADecrypt 使用 RSA 私钥对数据进行解密

func RSAEncrypt

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

RSAEncrypt 使用 RSA 公钥对数据进行加密

func Sha256Hash

func Sha256Hash(msg []byte) []byte

sha256 hash

func SignByPK

func SignByPK(privateKey *rsa.PrivateKey, hashMsg []byte) ([]byte, error)

sign by privateKey

func VerifySignature

func VerifySignature(publicKey *rsa.PublicKey, hashMsg []byte, signature []byte) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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