secureUtil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

README

相关链接

goEncrypt

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(cryted string, key string) string

func AesEncrypt

func AesEncrypt(orig string, key string) string

func Base64Decode

func Base64Decode(src []byte) ([]byte, error)

func Base64Encode

func Base64Encode(src []byte) []byte

func Check

func Check(content, encrypted string) bool

func DesDecrypt

func DesDecrypt(decrypted string, key []byte) (string, error)

key 只能为8位

func DesEncrypt

func DesEncrypt(text string, key []byte) (string, error)

key 只能为8位

func Encode

func Encode(data string) string

func GenRsaKey

func GenRsaKey(bits int, path string) error

func GetPriKeyLen

func GetPriKeyLen(PriKey []byte) (int, error)

*

  • @brief 获取RSA私钥长度
  • @param[in] PriKey RSA私钥
  • @return 成功返回 RSA私钥长度,失败返回error 错误信息

func GetPubKeyLen

func GetPubKeyLen(PubKey []byte) (int, error)

*

  • @brief 获取RSA公钥长度
  • @param[in] PubKey RSA公钥
  • @return 成功返回 RSA公钥长度,失败返回error 错误信息

func KeyPairs

func KeyPairs(keyName string) error

ecdsaCmd represents the doc command keyName 需要输入全路径

func LoadRsaPrivateKey

func LoadRsaPrivateKey(private64 string) (*rsa.PrivateKey, error)

func LoadRsaPublicKey

func LoadRsaPublicKey(public64 string) (*rsa.PublicKey, error)

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blocksize int) []byte

补码

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

去码

func RsaDecrypt

func RsaDecrypt(ciphertext []byte, privateKey []byte) ([]byte, error)

解密

func RsaEncrypt

func RsaEncrypt(origData []byte, publicKey []byte) ([]byte, error)

加密

func RsaSign

func RsaSign(privateKey *rsa.PrivateKey, data []byte) (string, error)

func RsaVerify

func RsaVerify(signature string, publicKey *rsa.PublicKey, data []byte) error

func Sha256

func Sha256(secret, data string) string

func ZeroPadding

func ZeroPadding(ciphertext []byte, blockSize int) []byte

func ZeroUnPadding

func ZeroUnPadding(origData []byte) []byte

Types

This section is empty.

Jump to

Keyboard shortcuts

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