aes

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 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

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

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

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

func EncryptUseCBC

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

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

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

func EncryptUseCTRNoPadding added in v1.2.0

func EncryptUseCTRNoPadding(plainText, key, iv []byte) ([]byte, 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 NoPadding added in v1.2.0

func NoPadding(cipherText []byte, blockSize int) []byte

func NoUnPadding added in v1.2.0

func NoUnPadding(origData []byte) []byte

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