Documentation ¶
Overview ¶
Package aes provides the AES encryption and decryption
Index ¶
- func DecodeCBCBase64(data string, key []byte) ([]byte, error)
- func DecryptCBC(crypted, key []byte) ([]byte, error)
- func EncodeCBCBase64(data, key []byte) (string, error)
- func EncryptCBC(data, key []byte) ([]byte, error)
- func PKCS5Padding(plaintext []byte, blockSize int) []byte
- func PKCS5UnPadding(data []byte) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeCBCBase64 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.