cryptotool

package
v0.0.0-...-f19f24e Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RSA_PRIVATE_KEY = iota
	RSA_PUBLIC_KEY
	RSA_CERT
)

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(dst, key []byte) ([]byte, error)

func AesEncrypt

func AesEncrypt(dst, key []byte) ([]byte, error)

func CheckSignature

func CheckSignature(result, secret string, body []byte) bool

func CreateAuthMap

func CreateAuthMap(key, secret, stringToSign string) map[string]string

func DecodeBase64

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

func DecodeBase64String

func DecodeBase64String(src string) (string, error)

func Decrypt

func Decrypt(ciphertext []byte, key []byte) ([]byte, error)

解密

func DesBase64Decrypt

func DesBase64Decrypt(dst, key, vector []byte) ([]byte, error)

func DesBase64Encrypt

func DesBase64Encrypt(dst, key, vector []byte) ([]byte, error)

func EncodeBase64

func EncodeBase64(src []byte) []byte

func Encrypt

func Encrypt(origData []byte, key []byte) ([]byte, error)

加密

func GetMD5

func GetMD5(src string, short bool) string

func GetMD5WithoutAny

func GetMD5WithoutAny(src string, short bool) string

func GetSha1

func GetSha1(data string) string

func GetSha256

func GetSha256(data string) string

func GetSha512

func GetSha512(data string) string

func HmacBase64Bytes

func HmacBase64Bytes(toSign, secret []byte) []byte

func HmacBytes

func HmacBytes(toSign, secret []byte) []byte

func HmacSignature

func HmacSignature(toSign, secret string) string

func Md5Signature

func Md5Signature(body []byte) string

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, size int) []byte

func PKCS5UnPadding

func PKCS5UnPadding(dst []byte) []byte

func ParseKey

func ParseKey(key []byte, kind int) (interface{}, error)

----------------------------------------------------------------------------

Types

type SHAwithRSA

type SHAwithRSA struct {
	// contains filtered or unexported fields
}

func NewSHAwithRSA

func NewSHAwithRSA() *SHAwithRSA

func (*SHAwithRSA) Sign

func (this *SHAwithRSA) Sign(data string, key []byte) ([]byte, error)

签名

func (*SHAwithRSA) Verify

func (this *SHAwithRSA) Verify(publicKey *rsa.PublicKey, data string, sig []byte) error

验证

Jump to

Keyboard shortcuts

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