-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
47 lines (38 loc) · 886 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"fmt"
"os"
"crypt"
"archive"
)
func main() {
// Extract zipped files
filenames, err := archive.ExtractData()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
// Start decryption process
if err := crypt.Decrypt(); err != nil {
fmt.Println(err)
os.Exit(1)
}
// Update password
if err := crypt.UpdatePassword(); err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println("Password successfully updated.")
fmt.Println("Encrypting data with the new password ...")
// Encrypt data with the new password
if err := crypt.Encrypt(); err != nil {
fmt.Println(err)
os.Exit(1)
}
// Create archive with the same name containing the updated password and newly encrypted data
if err := archive.CreateArchive(filenames); err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println("Data is successfully encrypted with the new pasword")
}