Documentation ¶
Index ¶
- Variables
- func Decrypt(ciphertext, key []byte) ([]byte, error)
- func DecryptOpenSSL(ciphertext, password string) (string, error)
- func DecryptWithPassword(ciphertext string, password string) (string, error)
- func Encrypt(plaintext, key []byte) ([]byte, error)
- func EncryptIfPlaintext(plaintext string, password string) (string, error)
- func EncryptWithPassword(plaintext string, password string) (string, error)
- func ReEncrypt(ciphertext, password string) (string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotEncrypted = errors.New("not an encrypted value")
View Source
var ErrTooMuchDataRead = errors.New("too much data read")
View Source
var Magic = []byte("CRYPT")
Functions ¶
func Decrypt ¶
Decrypts a ciphertext encrypted with AES-256-GCM. The first 12 bytes of the ciphertext is assumed to be the IV.
func DecryptOpenSSL ¶
func DecryptWithPassword ¶
Decrypts a base64-encoded ciphertext encrypted with EncryptWithPassword. Returns the plaintext as string.
func Encrypt ¶
Encrypts a plaintext with AES-256-GCM. Returns 12 bytes of IV, and then N bytes of ciphertext.
func EncryptIfPlaintext ¶
Encrypt plaintext if not already encrypted, using EncryptWithPassword.
func EncryptWithPassword ¶
Encrypt and base64-encode data using aes-256-gcm and a key derived from a password hashed with PBKDF2. Output is a base64-encoded string with 16 bytes of PBKDF2 salt, 12 bytes of iv, followed by ciphertext.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.