Give error handling control to importing applications

This commit is contained in:
2025-05-03 18:42:55 -04:00
parent 146901a479
commit 111d70596a
3 changed files with 28 additions and 20 deletions
+14 -2
View File
@@ -28,6 +28,10 @@ import (
// Store:
// Hash of passphrase (prevent user from losing data by accidentally providing incorrect passphrase during encryption)
// Order of algorithms (determined randomly at keyfile generation)
// Security:
// Play with nonce sizes and Argon2 parameters to find the best speed-security balance
// Standalone cmd:
// Usable as symmetric-only GPG replacement
func main() {
switch len(os.Args) {
@@ -37,8 +41,16 @@ func main() {
case 3:
// decrypt file
encBytes, _ := os.ReadFile("encrypted-example.txt")
decBytes := wrappers.DecryptCha(encBytes, []byte(os.Args[2]))
decBytes = wrappers.DecryptAES(decBytes, []byte(os.Args[2]))
decBytes, err := wrappers.DecryptCha(encBytes, []byte(os.Args[2]))
if err != nil {
fmt.Println(err)
return
}
decBytes, err = wrappers.DecryptAES(decBytes, []byte(os.Args[2]))
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(decBytes))
case 4:
// encrypt data (from cli args)