Documentation
¶
Index ¶
- func Decrypt(msg []byte) []byte
- func DecryptString(msg string) string
- func Encrypt(msg []byte) []byte
- func EncryptString(msg string) string
- func GenerateKey() string
- func GeneratePlaceholders(start, end uint) string
- func GetPublicKey(key *rsa.PrivateKey) string
- func ParsePrivateKey(key string) *rsa.PrivateKey
- func RandomSecret(length int) string
- func RandomStringGenerator() func(length int) string
- func ResponseBodyToString(r *http.Response) string
- func SetKey(key []byte) error
- func StringSliceToInterfaceSlice(s []string) []interface{}
- func StripTerminalColorCodes(s string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptString ¶
Decrypts a string using the package global key.
func EncryptString ¶
Encrypts a string using the package global key.
func GenerateKey ¶
func GenerateKey() string
Generates an RSA key (2048 bit) and encodes it using PEM.
func GeneratePlaceholders ¶
Generates placeholders from start to end for an SQL query.
func GetPublicKey ¶
func GetPublicKey(key *rsa.PrivateKey) string
Gets the public part of a private key in OpenSSL format.
func ParsePrivateKey ¶
func ParsePrivateKey(key string) *rsa.PrivateKey
Parses a PEM private key. Returns nil on failure.
func RandomSecret ¶
RandomSecret generates a random secret of length bytes long.
The returned data will be hex encoded, so it will be length*2 characters.
func RandomStringGenerator ¶
Creates a function that generates random strings with a given length.
The generated function is not thread-safe. This function is not secure. Use this for dummy info or temp files, but DO NOT use this to generate passwords or other cryptographically sensitive data.
func ResponseBodyToString ¶
Reads the whole response body and converts it to a string.
func SetKey ¶
Sets the package global secret. The size of the secret should be 32 bytes. See Encrypt() and Decrypt()
func StringSliceToInterfaceSlice ¶
func StringSliceToInterfaceSlice(s []string) []interface{}
Converts a string slice into an interface{} slice.
func StripTerminalColorCodes ¶
Types ¶
This section is empty.