Documentation ¶
Index ¶
- func AesDecrypt(msg, k string) (string, error)
- func AesEncrypt(src, k string) (string, error)
- func Base64UrlSafeEncode(source []byte) string
- func DecryptUseCBC(cipherText, key []byte, iv []byte) ([]byte, error)
- func DecryptUseCBCWithDefaultProtocol(cipherText, key []byte) ([]byte, error)
- func EncryptUseCBC(plainText, key, iv []byte) ([]byte, error)
- func EncryptUseCBCWithDefaultProtocol(plainText, key []byte) ([]byte, error)
- func NewECBDecrypter(b cipher.Block) cipher.BlockMode
- func NewECBEncrypter(b cipher.Block) cipher.BlockMode
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AesDecrypt ¶
func AesEncrypt ¶
func Base64UrlSafeEncode ¶
func DecryptUseCBC ¶
Decrypt using cbc mode There are two kinds of panic that may occur: 1. When iv length do not equal block size 2. When key does not match the cipher text, and it always happens when do unpadding
func DecryptUseCBCWithDefaultProtocol ¶
Decrypt using given iv parameter and cbc mode When key does not match the cipher text, it will panic
func EncryptUseCBC ¶
Encrypt using cbc mode When iv length does not equal block size, it will panic
func EncryptUseCBCWithDefaultProtocol ¶
Encrypt using random iv parameter and cbc mode Never panic, only possible to return an error
func NewECBDecrypter ¶
NewECBDecrypter returns a BlockMode which decrypts in electronic code book mode, using the given Block.
func NewECBEncrypter ¶
NewECBEncrypter returns a BlockMode which encrypts in electronic code book mode, using the given Block.
func PKCS5Padding ¶
func PKCS5UnPadding ¶
Types ¶
This section is empty.