summaryrefslogtreecommitdiff
path: root/internal/goaes.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/goaes.go')
-rw-r--r--internal/goaes.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/goaes.go b/internal/goaes.go
new file mode 100644
index 0000000..668ef17
--- /dev/null
+++ b/internal/goaes.go
@@ -0,0 +1,15 @@
+package internal
+
+import (
+ "crypto/rand"
+ "fmt"
+ "io"
+)
+
+func NewDEK() (DEK, error) {
+ key := make([]byte, 32) // AES-256
+ if _, err := io.ReadFull(rand.Reader, key); err != nil {
+ return nil, fmt.Errorf("random DEK gen: %w", err)
+ }
+ return DEK(key), nil
+}