aboutsummaryrefslogtreecommitdiff
path: root/internal/nametransform
diff options
context:
space:
mode:
Diffstat (limited to 'internal/nametransform')
-rw-r--r--internal/nametransform/diriv.go6
-rw-r--r--internal/nametransform/longnames.go6
-rw-r--r--internal/nametransform/names.go6
3 files changed, 11 insertions, 7 deletions
diff --git a/internal/nametransform/diriv.go b/internal/nametransform/diriv.go
index 9c3c1d1..6687b40 100644
--- a/internal/nametransform/diriv.go
+++ b/internal/nametransform/diriv.go
@@ -14,10 +14,10 @@ import (
)
const (
- // identical to AES block size
+ // DirIVLen is identical to AES block size
DirIVLen = 16
- // dirIV is stored in this file. Exported because we have to ignore this
- // name in directory listing.
+ // DirIVFilename is the filename used to store directory IV.
+ // Exported because we have to ignore this name in directory listing.
DirIVFilename = "gocryptfs.diriv"
)
diff --git a/internal/nametransform/longnames.go b/internal/nametransform/longnames.go
index e61e21b..be00bb4 100644
--- a/internal/nametransform/longnames.go
+++ b/internal/nametransform/longnames.go
@@ -14,6 +14,7 @@ import (
)
const (
+ // LongNameSuffix is the suffix used for files with long names.
// Files with long names are stored in two files:
// gocryptfs.longname.[sha256] <--- File content, prefix = gocryptfs.longname.
// gocryptfs.longname.[sha256].name <--- File name, suffix = .name
@@ -31,12 +32,13 @@ func HashLongName(name string) string {
// Values returned by IsLongName
const (
- // File that stores the file content.
+ // LongNameContent is the file that stores the file content.
// Example: gocryptfs.longname.URrM8kgxTKYMgCk4hKk7RO9Lcfr30XQof4L_5bD9Iro=
LongNameContent = iota
- // File that stores the full encrypted filename.
+ // LongNameFilename is the file that stores the full encrypted filename.
// Example: gocryptfs.longname.URrM8kgxTKYMgCk4hKk7RO9Lcfr30XQof4L_5bD9Iro=.name
LongNameFilename = iota
+ // LongNameNone is used when the file does not have a long name.
// Example: i1bpTaVLZq7sRNA9mL_2Ig==
LongNameNone = iota
)
diff --git a/internal/nametransform/names.go b/internal/nametransform/names.go
index 4850138..05ae75e 100644
--- a/internal/nametransform/names.go
+++ b/internal/nametransform/names.go
@@ -1,4 +1,4 @@
-// Package namtransforms encrypts and decrypts filenames.
+// Package nametransform encrypts and decrypts filenames.
package nametransform
import (
@@ -12,12 +12,14 @@ import (
"github.com/rfjakob/gocryptfs/internal/tlog"
)
+// NameTransform is used to transform filenames.
type NameTransform struct {
cryptoCore *cryptocore.CryptoCore
longNames bool
DirIVCache dirIVCache
}
+// New returns a new NameTransform instance.
func New(c *cryptocore.CryptoCore, longNames bool) *NameTransform {
return &NameTransform{
cryptoCore: c,
@@ -51,7 +53,7 @@ func (n *NameTransform) DecryptName(cipherName string, iv []byte) (string, error
return plain, err
}
-// encryptName - encrypt "plainName", return base64-encoded "cipherName64".
+// EncryptName encrypts "plainName", returns a base64-encoded "cipherName64".
// Used internally by EncryptPathDirIV().
// The encryption is either CBC or EME, depending on "useEME".
//