Skip to content

jht5945/encfs-afero

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

encfs-afero

Used encryption algorithm AES-CTR.

File format:

  • content.txt - Original file(Encrypted with AES/CTR)
  • content.txt.__encfile - Meta file(original file name and IV)

How AES/CTR works explain:

Image is from: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation

Sample code:

package main

import "github.com/jht5945/encfs-afero/encfs"

func main() {
	fs := encfs.NewEncFs(encfs.NewEncryptionMasterKey(make([]byte, 32)))
	f, err := fs.Create("aa")
	if err != nil {
		println("Error: ", err)
		return
	}
	f.WriteString("hello world")
}

Sample code will generate fiels:

-rw-r--r--  1 hatterjiang  staff     11 Dec 21 10:56 aa
-rw-r--r--  1 hatterjiang  staff     45 Dec 21 10:56 aa.__encfile

aa is encrypted file, and aa.__encfile is meta file.

$ cat aa.__encfile | jq .
{
  "name": "aa",
  "iv": "ue0IcDegDuwZjNgND1vUIQ=="
}

File name can be encrypted after set FileNameIv in EncryptionMasterKey.

About

Encryption support(AES-CTR) for afero

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages