aes

package
v2.1.41 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 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, key string) (string, error)

AesDecrypt decrypt/ecb The key argument should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.

func AesEncrypt

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

AesEncrypt encrypt/ecb The key argument should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.

func Base64UrlSafeEncode

func Base64UrlSafeEncode(source []byte) string

Base64UrlSafeEncode Base64 Url Safe is the same as Base64 but does not contain '/' and '+' (replaced by '_' and '-') and trailing '=' are removed.

func DecryptUseCBC

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

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

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

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

func DecryptUseCTRNoPadding

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

func EncryptUseCBC

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

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

func EncryptUseCBCWithDefaultProtocol

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

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

func EncryptUseCTRNoPadding

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

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

func NoUnPadding

func NoUnPadding(origData []byte) []byte

func PKCS5Padding

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

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) ([]byte, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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