aes

package
v0.1.38 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package aes provides the AES encryption and decryption

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeCBCBase64

func DecodeCBCBase64(data string, key []byte) ([]byte, error)

DecodeCBCBase64 decrypts the base64-encoded data using the provided key and returns the decrypted data.

Parameters: - data: the base64-encoded data to be decrypted (string) - key: the decryption key ([]byte)

Returns: - []byte: the decrypted data - error: an error if the decryption fails

func DecryptCBC

func DecryptCBC(crypted, key []byte) ([]byte, error)

DecryptCBC decrypts the given ciphertext using the provided key.

Parameters: - crypted: the ciphertext to be decrypted ([]byte) - key: the decryption key ([]byte)

Returns: - []byte: the decrypted data - error: an error if the decryption fails

func EncodeCBCBase64

func EncodeCBCBase64(data, key []byte) (string, error)

EncodeCBCBase64 encrypts the given original data using the provided key and returns the encrypted data as a base64-encoded string.

Parameters: - data: the data to be encrypted ([]byte) - key: the encryption key ([]byte)

Returns: - string: the encrypted data as a base64-encoded string - error: an error if the encryption fails

func EncryptCBC

func EncryptCBC(data, key []byte) ([]byte, error)

EncryptCBC encrypts the given original data using the provided key using the AES encryption algorithm in CBC mode.

Parameters: - data: the data to be encrypted ([]byte) - key: the encryption key ([]byte)

Returns: - []byte: the encrypted data - error: an error if the encryption fails

func PKCS5Padding

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

PKCS5Padding adds padding to the plaintext based on the blockSize.

plaintext: The data to pad. blockSize: The block size used for padding. []byte: The padded plaintext.

func PKCS5UnPadding

func PKCS5UnPadding(data []byte) []byte

PKCS5UnPadding removes the padding from the given byte array.

Parameters: - data: the byte array to remove the padding from.

Returns: - []byte: the byte array with the padding removed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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