- Get the library using:
go get github.com/Tiked/FileEncryption
- Import it:
import "github.com/Tiked/FileEncryption"
package main
import "github.com/Tiked/FileEncryption"
func main() {
// First initialize the chipher with your key. use a 32 bytes slice
FileEncryption.InitializeBlock([]byte("a very very very very secret key"))
// Now encrypt a file with its path
err := FileEncryption.Encrypter("/home/desktop/data.txt")
if err != nil {
panic(err.Error())
}
// Now you should see data.txt.enc in your desktop
// To decrypt it
err = FileEncryption.Decrypter("/home/desktop/data.txt.enc")
if err != nil {
panic(err.Error())
}
// Now you should see data.txt in your desktop
}
- Encrypts large files using stream encryption
- Per-file unique IV handling