updated security.Encrypt and security.Decrypt docs
This commit is contained in:
parent
a5eff395b4
commit
be40803d31
File diff suppressed because it is too large
Load Diff
|
@ -8,7 +8,9 @@ import (
|
||||||
"io"
|
"io"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Encrypt encrypts data with key (must be valid 32 char aes key).
|
// Encrypt encrypts "data" with the specified "key" (must be valid 32 char AES key).
|
||||||
|
//
|
||||||
|
// This method uses AES-256-GCM block cypher mode.
|
||||||
func Encrypt(data []byte, key string) (string, error) {
|
func Encrypt(data []byte, key string) (string, error) {
|
||||||
block, err := aes.NewCipher([]byte(key))
|
block, err := aes.NewCipher([]byte(key))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -34,7 +36,9 @@ func Encrypt(data []byte, key string) (string, error) {
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decrypt decrypts encrypted text with key (must be valid 32 chars aes key).
|
// Decrypt decrypts encrypted text with key (must be valid 32 chars AES key).
|
||||||
|
//
|
||||||
|
// This method uses AES-256-GCM block cypher mode.
|
||||||
func Decrypt(cipherText string, key string) ([]byte, error) {
|
func Decrypt(cipherText string, key string) ([]byte, error) {
|
||||||
block, err := aes.NewCipher([]byte(key))
|
block, err := aes.NewCipher([]byte(key))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue