Documentation ¶
Overview ¶
Package sym is a simple and lightweight symmetric encryption/decryption pkg.
Index ¶
- Variables
- func DecryptBytes(key string, ciphertextBytes []byte) ([]byte, error)
- func DecryptFile(key, in, out string) error
- func DecryptString(key, ciphertext string) (string, error)
- func EncryptBytes(key string, plaintextBytes []byte) ([]byte, error)
- func EncryptFile(key, in, out string) error
- func EncryptString(key, plaintext string) (string, error)
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyPayload = errors.New("empty payload")
ErrEmptyPayload is returned when the ciphertext string or bytes provided for an encrypt/decrypt operation are empty or nil.
var ErrInvalidIvLen = errors.New("cipher text does not contain a valid initialization vector length")
ErrInvalidIvLen is returned when the provided ciphertext for a decrypt operation is not at least the length of a valid initialization vector.
Functions ¶
func DecryptBytes ¶
DecryptBytes uses key to return the decrypted content of 'ciphertextBytes'.
func DecryptFile ¶
DecryptFile opens in and uses key to decrypt it's ciphertext contents; writing the plaintext contents to out.
func DecryptString ¶
DecryptString uses key to return the decrypted string contents of ciphertext.
func EncryptBytes ¶
EncryptBytes uses key to encrypt plaintext; returning the ciphertext bytes.
func EncryptFile ¶
EncryptFile opens in and uses key to encrypt it's plaintext contents; writing the ciphertext contents to out.
func EncryptString ¶
EncryptString uses key to encrypt plaintext; returning the ciphertext string.
Types ¶
This section is empty.