Documentation ¶
Overview ¶
Package 3dfosi/gocrypt provides simplified helper functions for using scrypt (128-bit salt, N=32768, r=8 and p=1) generated hash as a key to encrypt data with AES-256-GCM.
Common use cases include but are not limited to encrypting data at rest for applications and symetric encryption automation prior to transfering files to destination.
Index ¶
- func Decrypt(data []byte, salt []byte, pass string) ([]byte, error)
- func DecryptFile(file string, from string, to string, passphrase string) error
- func DecryptFromFile(file string, salt []byte, passphrase string) ([]byte, error)
- func Encrypt(data []byte, pass string) ([]byte, []byte, error)
- func EncryptFile(file string, from string, to string, passphrase string) error
- func EncryptToFile(file string, to string, data []byte, passphrase string) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Function to decrypt data
Variables to pass in:
data []byte - Data to be encrypted salt []byte - Salt to use to create hash pass string - Passphrase to use for encryption
Returns:
[]byte - Decrypted Data error - Error
func DecryptFile ¶
Function to decrypt data from a file and output to a new file
Variables to pass in:
file string - Name of the file from string - Specify path of file to string - Specify destination path to output file (must end with "/" ie. /opt/app/ instead of /opt/app) pass string - Passphrase to use for encryption
Returns:
[]byte - Salt used to encrypt error - Error
func DecryptFromFile ¶
Function to decrypt data from a file
Variables to pass in:
file string - Name of the file (full path) salt []byte - Salt used to create hash pass string - Passphrase to use for encryption
Returns:
[]byte - Decrypted Data error - Error
func Encrypt ¶
Function to encrypt data
Variables to pass in:
data []byte - Data to be encrypted pass string - Passphrase to use for encryption
Returns:
[]byte - Encrypted Data []byte - Salt error - Error
func EncryptFile ¶
Function to encrypt an existing file.
Variables to pass in:
file string - Name of the file from string - Specify path of file to string - Specify destination path to output file (must end with "/" ie. /opt/app/ instead of /opt/app) pass string - Passphrase to use for encryption
Returns:
[]byte - Salt used to encrypt error - Error
func EncryptToFile ¶
Function to encrypt data and output to a file
Variables to pass in:
file string - Name of the file (full path) to string - Specify destination path of file (must end with "/" ie. /opt/app/ instead of /opt/app) pass string - Passphrase to use for encryption
Returns:
[]byte - Salt used to encrypt error - Error
Types ¶
This section is empty.