aesencrypt

package
v0.0.0-...-5aca00c Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const IVSize = 16

IVSize AES IV size

Variables

This section is empty.

Functions

func AESDecrypt

func AESDecrypt(encrypted []byte, key []byte, iv []byte) (decrypted []byte, err error)

AESDecrypt decrypt data with given key and iv. Data will be unpadding with PKCS7Unpadding. Return decrypted data and any error if raised.

func AESDecryptBase64

func AESDecryptBase64(encrypted string, key []byte, iv []byte) (decrypted []byte, err error)

AESDecryptBase64 decrypt base64 encoded data with given key and iv. Data will be unpadding with PKCS7Unpadding. Return decrypted data and any error if raised.

func AESEncrypt

func AESEncrypt(unencrypted []byte, key []byte, iv []byte) (encrypted []byte, err error)

AESEncrypt aes encrypt with given data,key and iv. Data will be padding with PKCS7Padding Return encrytped data and any error if raised.

func AESEncryptBase64

func AESEncryptBase64(unencrypted []byte, key []byte, iv []byte) (encrypted string, err error)

AESEncryptBase64 aes encrypt with given data,key and iv. Data will be padding with PKCS7Padding Return base64 encoded encrytped data and any error if raised.

func AESNonceDecrypt

func AESNonceDecrypt(encrypted []byte, key []byte) (decrypted []byte, err error)

AESNonceDecrypt decrypt data with given key. IV will load form first bytes of data. Data will be unpadding with PKCS7Unpadding. Return decrypted data and any error if raised.

func AESNonceDecryptBase64

func AESNonceDecryptBase64(encrypted string, key []byte) (decrypted []byte, err error)

AESNonceDecryptBase64 decrypt base64 encoded data with given key. IV will load form first bytes of data. Data will be unpadding with PKCS7Unpadding. Return decrypted data and any error if raised.

func AESNonceEncrypt

func AESNonceEncrypt(unencrypted []byte, key []byte) (encrypted []byte, err error)

AESNonceEncrypt aes encrypt data with given key and random bytes as IV. Data will be padding with PKCS7Padding Random IV will prefix encryped data return encrypted data and any error if raisd.

func AESNonceEncryptBase64

func AESNonceEncryptBase64(unencrypted []byte, key []byte) (encrypted string, err error)

AESNonceEncryptBase64 aes encrypt data with given key and random bytes as IV. Data will be padding with PKCS7Padding Random IV will prefix encryped data return base64 encoded encrypted data and any error if raisd.

func PKCS7Padding

func PKCS7Padding(data []byte, blockSize int) []byte

PKCS7Padding padding data as PKCS7 Reference http://blog.studygolang.com/167.html

func PKCS7Unpadding

func PKCS7Unpadding(data []byte) []byte

PKCS7Unpadding unpadding data as PKCS7 Reference http://blog.studygolang.com/167.html

Types

This section is empty.

Jump to

Keyboard shortcuts

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