mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 05:11:06 +02:00
Encryption works, cleanup is good
This commit is contained in:
parent
e59df2e617
commit
0cf680fd66
4 changed files with 73 additions and 27 deletions
5
main.go
5
main.go
|
@ -56,17 +56,20 @@ func main() {
|
|||
|
||||
if connectionTypeFlag == "s" {
|
||||
// encrypt the file
|
||||
fmt.Println("encrypting...")
|
||||
fdata, err := ioutil.ReadFile(fileName)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return
|
||||
}
|
||||
encrypted, err := Encrypt(fdata, codePhraseFlag)
|
||||
encrypted, salt, iv := Encrypt(fdata, codePhraseFlag)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return
|
||||
}
|
||||
ioutil.WriteFile(fileName+".encrypted", encrypted, 0644)
|
||||
ioutil.WriteFile(fileName+".salt", []byte(salt), 0644)
|
||||
ioutil.WriteFile(fileName+".iv", []byte(iv), 0644)
|
||||
}
|
||||
|
||||
log.SetFormatter(&log.TextFormatter{})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue