aes

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(msg, k string) (string, error)

func AesEncrypt

func AesEncrypt(src, k string) (string, error)

func Base64UrlSafeEncode

func Base64UrlSafeEncode(source []byte) string

func DecryptUseCBC added in v1.1.0

func DecryptUseCBC(cipherText, key []byte, iv []byte) ([]byte, error)

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 added in v1.1.0

func DecryptUseCBCWithDefaultProtocol(cipherText, key []byte) ([]byte, error)

Decrypt using given iv parameter and cbc mode When key does not match the cipher text, it will panic

func EncryptUseCBC added in v1.1.0

func EncryptUseCBC(plainText, key, iv []byte) ([]byte, error)

Encrypt using cbc mode When iv length does not equal block size, it will panic

func EncryptUseCBCWithDefaultProtocol added in v1.1.0

func EncryptUseCBCWithDefaultProtocol(plainText, key []byte) ([]byte, error)

Encrypt using random iv parameter and cbc mode Never panic, only possible to return an error

func NewECBDecrypter

func NewECBDecrypter(b cipher.Block) cipher.BlockMode

NewECBDecrypter returns a BlockMode which decrypts in electronic code book mode, using the given Block.

func NewECBEncrypter

func NewECBEncrypter(b cipher.Block) cipher.BlockMode

NewECBEncrypter returns a BlockMode which encrypts in electronic code book mode, using the given Block.

func PKCS5Padding

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

func PKCS5UnPadding

func PKCS5UnPadding(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