cryptos

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecryptCBC

func AesDecryptCBC(encrypted []byte, key []byte) (decrypted []byte, err error)

AesDecryptCBC key的长度必须为16, 24或者32

func AesEncryptCBC

func AesEncryptCBC(origData []byte, key []byte) (encrypted []byte, err error)

AesEncryptCBC key的长度必须为16, 24或者32

func CompPwd

func CompPwd(hashPwd, srcPwd string) bool

CompPwd 验证密码

func DecodeString

func DecodeString(message string) ([]byte, error)

func EncodeToString

func EncodeToString(data []byte) string

func GenPwd

func GenPwd(pwd string) (enPwd string, err error)

GenPwd 生成密码

func GenerateRsaKey

func GenerateRsaKey(len int) ([]byte, []byte, error)

生成密钥对

func GenerateRsaKeyStr

func GenerateRsaKeyStr(len int) (publicKey string, privateKey string, err error)

生成密钥对

func MD5

func MD5(data []byte) string

MD5

func MD5File

func MD5File(filename string) string

MD5File /*

func ParsePriKey

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

将byte转为私钥

func ParsePriKeyPkcs8

func ParsePriKeyPkcs8(privateKeyPkcs8 []byte) (*rsa.PrivateKey, error)

将Pkcs8 格式byte转为私钥

func ParsePubKey

func ParsePubKey(publicKey []byte) (*rsa.PublicKey, error)

将byte转换为RSA公钥

func PrivateKeyPkcs8ToPem

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

将RSAP kcs8私钥转换为byte

func PrivateKeyToPem

func PrivateKeyToPem(privateKey *rsa.PrivateKey) []byte

将RSA私钥转换为byte

func PublicKeyToPem

func PublicKeyToPem(publicKey *rsa.PublicKey) ([]byte, error)

将RSA公钥转换为byte

func RSA_Decrypt

func RSA_Decrypt(encryptedMsg, priKey string) ([]byte, error)

私钥解密

func RSA_DecryptPkcs8

func RSA_DecryptPkcs8(encryptedMsg, priKey string) ([]byte, error)

私钥解密Pkcs8 Key

func RSA_Encrypt

func RSA_Encrypt(message []byte, pubKey string) (string, error)

公钥加密

func RSA_Sign

func RSA_Sign(priKey string, message []byte) ([]byte, error)

RsaSign 私钥加签

func RSA_SignPkcs8

func RSA_SignPkcs8(priKey string, message []byte) ([]byte, error)

RsaSign 私钥加签

func RSA_Verify

func RSA_Verify(publicKeyPEM string, message []byte, signature []byte) error

RsaVerify 公钥验签

func RsaDecrypt

func RsaDecrypt(encryptedMsg, priKey []byte) ([]byte, error)

私钥解密

func RsaDecryptPkcs8

func RsaDecryptPkcs8(encryptedMsg, priKey []byte) ([]byte, error)

私钥解密 Pkcs8 Key

func RsaEncrypt

func RsaEncrypt(message []byte, pubKey []byte) ([]byte, error)

公钥加密

func RsaPriKeyPkcs1To8

func RsaPriKeyPkcs1To8(priPkcs1Key []byte) (string, error)

func RsaPriKeyPkcs8To1

func RsaPriKeyPkcs8To1(priPkcs8Key []byte) (string, error)

func RsaSign

func RsaSign(priKey, message []byte) ([]byte, error)

RsaSign 私钥加签

func RsaSignKey

func RsaSignKey(pkey *rsa.PrivateKey, message []byte) ([]byte, error)

根据私钥加签

func RsaSignPkcs8

func RsaSignPkcs8(priKey, message []byte) ([]byte, error)

RsaSign Pkcs8私钥加签

func RsaSignWithHash

func RsaSignWithHash(pkey *rsa.PrivateKey, message []byte, algorithm uint16) ([]byte, error)

func RsaVerify

func RsaVerify(publicKeyPEM, message []byte, signature []byte) error

RsaVerify 公钥验签

func RsaVerifyWithHash

func RsaVerifyWithHash(publicKeyPEM, message []byte, signature []byte, algorithm uint16) error

func SHA256

func SHA256(data []byte) string

SHA256 sha256

Types

This section is empty.

Jump to

Keyboard shortcuts

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