Documentation ¶
Overview ¶
Please ensure, that in this package is no logging activated. There wont be console-outputs or other prints, you have to handle the "error", if any, by yourself.
The gocrypt package contains a private variable, this variable stores the default encryption passphrase. Make sure to change the default encryption passphrase if you dont want to specify your own encryption passphrase everytime the encrypt/decrypt functions are called.
Happy Encrypting!
Index ¶
- func CreateRandomPassphrase(length int) string
- func Decrypt(_passphrase, text string) (string, error)
- func DecryptWithDefault(text string) (string, error)
- func Encrypt(passphrase, text string) (string, error)
- func EncryptWithDefault(text string) (string, error)
- func GetDefaultPassphrase() string
- func SetDefaultPassphrase(passphrase string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateRandomPassphrase ¶ added in v1.4.3
create a random passphrase for de- and encryption
Parameters:
- `length` : int > length of the generated passphrase
func Decrypt ¶
uses the decryption with the given passphrase, returns the decrypted version of "text" or an error
Parameters:
- `passphrase` : string > contains the string, which is used to decrypt the value of `text`
- `text` : string > contains the text to decrypt
func DecryptWithDefault ¶
uses the decryption with the default passphrase, returns the decrypted version of "text" or an error
Parameters:
- `text` : string > contains the text to decrypt
func Encrypt ¶
uses the encryption with the given passphrase, returns the encrypted version of "text" or an error
Parameters:
- `passphrase` : string > contains the string, which is used to encrypt the value of `text`
- `text` : string > contains the text to encrypt
func EncryptWithDefault ¶
uses the encryption with the default passphrase, returns the encrypted version of "text" or an error
Parameters:
- `text` : string > contains the text to encrypt
func GetDefaultPassphrase ¶
func GetDefaultPassphrase() string
return the Default Encryption Passphrase
func SetDefaultPassphrase ¶
func SetDefaultPassphrase(passphrase string)
set another Default Encryption Passphrase, but remember, if changed, the strings, which were encrypted with the old value cant be decrypted anymore
Parameters:
- `passphrase` : string > contains the new encryption-passphrase
Types ¶
This section is empty.