Skip to content

Commit

Permalink
Correction bug chiffrement dun fichier deja chiffre
Browse files Browse the repository at this point in the history
  • Loading branch information
Heisenberk committed Apr 13, 2019
1 parent 9cdc617 commit 1e0f27c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
12 changes: 7 additions & 5 deletions crypto/decrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,13 @@ func DecryptFileFolder(d *structure.Documents) {
// si l'objet spécifié par le chemin est un fichier.
}else if mode.IsRegular()== true {

// Déchiffrement du fichier.
errFile := DecryptFileAES(d.Doc[i],d)
if errFile != nil {
fmt.Println(errFile)
}
if d.Doc[i][len(d.Doc[i])-4:]==".gsh"{
// Déchiffrement du fichier.
errFile := DecryptFileAES(d.Doc[i],d)
if errFile != nil {
fmt.Println(errFile)
}
}
}
}
}
Expand Down
23 changes: 14 additions & 9 deletions crypto/encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,13 @@ func EncryptFolder (path string, d *structure.Documents) {

// Si l'objet spécifié par le chemin est un fichier.
}else if mode.IsRegular()== true {
errFile := EncryptFileAES(newPath,d)
if errFile != nil {
fmt.Println(errFile)
}
// si l'extension du fichier est différent de .gsh on peut chiffrer le fichier.
if newPath[len(newPath)-4:]!=".gsh"{
errFile := EncryptFileAES(newPath,d)
if errFile != nil {
fmt.Println(errFile)
}
}
}
}
}
Expand Down Expand Up @@ -248,11 +251,13 @@ func EncryptFileFolder(d *structure.Documents) {
// Si l'objet spécifié par le chemin est un fichier.
}else if mode.IsRegular()== true {

// Chiffrement du fichier.
errFile := EncryptFileAES(d.Doc[i],d)
if errFile != nil {
fmt.Println(errFile)
}
if d.Doc[i][len(d.Doc[i])-4:]!=".gsh"{
// Chiffrement du fichier.
errFile := EncryptFileAES(d.Doc[i],d)
if errFile != nil {
fmt.Println(errFile)
}
}
}
}
}
Expand Down

0 comments on commit 1e0f27c

Please sign in to comment.