Documentation
¶
Index ¶
- Constants
- func AesDecrypt(content string, key string, iv string) string
- func AesDecryptCBC(content string, key string) string
- func AesDecryptECB(content string, key string) string
- func AesEncrypt(content string, key string, iv string) string
- func AesEncryptCBC(content string, key string) string
- func AesEncryptECB(content string, key string) string
- func Base64Decrypt(content string) string
- func Base64Encrypt(content string) string
- func DESDecryptCBC(content string, key string, iv string) string
- func DESDecryptECB(content string, key string) string
- func DESEncryptCBC(content string, key string, iv string) string
- func DESEncryptECB(content string, key string) string
- func DSAGenerateKeyPair(size dsa.ParameterSizes, privateKeyPath string, publicKeyPath string) error
- func DSASign(content string, privKeyPath string) (r, s *big.Int, err error)
- func DSAVerify(content string, pubKeyPath string, r, s *big.Int) (bool, error)
- func HMacMD5File(filePath string, key string) (string, error)
- func HMacMD5String(s string, key string) string
- func HMacSha1File(filePath string, key string) (string, error)
- func HMacSha1String(s string, key string) string
- func HMacSha256File(filePath string, key string) (string, error)
- func HMacSha256String(s string, key string) string
- func MD5File(filePath string) (string, error)
- func MD5String(s string) string
- func RC4Decrypt(content string, key string) string
- func RC4Encrypt(content string, key string) string
- func RSADecrypt(content string, privateKeyPath string) (string, error)
- func RSAEncrypt(content string, publicKeyPath string) (string, error)
- func RSAGenerateKeyPair(size int, privateKeyPath string, publicKeyPath string) error
- func Sha1File(filePath string) (string, error)
- func Sha1String(s string) string
- func Sha256File(filePath string) (string, error)
- func Sha256String(s string) string
- type Cipher
- func (c *Cipher) Decode(cipherText string) ([]byte, error)
- func (c *Cipher) Decrypt(block cipher.Block, cipherData []byte) (err error)
- func (c *Cipher) Encode() string
- func (c *Cipher) Encrypt(block cipher.Block, plainData []byte) (err error)
- func (c *Cipher) Fill(plainText []byte, blockSize int) []byte
- func (c *Cipher) NewECBDecrypter(block cipher.Block, cipherData []byte)
- func (c *Cipher) NewECBEncrypter(block cipher.Block, plainData []byte)
- func (c *Cipher) UnFill(plainText []byte) (data []byte, err error)
- type CipherText
- type Crypto
- type FillMode
Constants ¶
View Source
const ( CBCMode = iota CFBMode CTRMode ECBMode OFBMode )
View Source
const ( PrintHex = iota PrintBase64 )
View Source
const ( RSA_KEY_SIZE_256 = 256 RSA_KEY_SIZE_512 = 512 RSA_KEY_SIZE_1024 = 1024 RSA_KEY_SIZE_2048 = 2048 )
Variables ¶
This section is empty.
Functions ¶
func AesDecryptCBC ¶ added in v1.3.0
func AesDecryptECB ¶
AesDecryptECB 兼容java的AES解密方式
func AesEncryptCBC ¶ added in v1.3.0
func AesEncryptECB ¶
AesEncryptECB 兼容java的AES加密方式
func Base64Decrypt ¶
func Base64Encrypt ¶
func DESDecryptECB ¶
func DESEncryptECB ¶
func DSAGenerateKeyPair ¶
func DSAGenerateKeyPair(size dsa.ParameterSizes, privateKeyPath string, publicKeyPath string) error
func HMacMD5String ¶
func HMacSha1String ¶
func HMacSha256String ¶
func RC4Decrypt ¶
func RC4Encrypt ¶
func RSAGenerateKeyPair ¶
func Sha1String ¶
func Sha256File ¶
func Sha256String ¶
Types ¶
type Cipher ¶
type Cipher struct { GroupMode int FillMode FillMode DecodeType int Key []byte Iv []byte Output CipherText }
func (*Cipher) NewECBDecrypter ¶
func (*Cipher) NewECBEncrypter ¶
type CipherText ¶
type CipherText []byte
Click to show internal directories.
Click to hide internal directories.