mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 05:11:06 +02:00
check meta data for decryption flag
This commit is contained in:
parent
7be11a6fda
commit
efee59f541
1 changed files with 5 additions and 1 deletions
|
@ -67,6 +67,7 @@ func (c *Croc) processFile(src string) (err error) {
|
|||
return
|
||||
}
|
||||
fd.IsCompressed = c.UseCompression
|
||||
fd.IsEncrypted = c.UseEncryption
|
||||
|
||||
fd.Hash, err = hashFile(c.crocFile)
|
||||
if err != nil {
|
||||
|
@ -204,13 +205,16 @@ func (c *Croc) processReceivedFile() (err error) {
|
|||
log.Error(err)
|
||||
return
|
||||
}
|
||||
if c.UseEncryption {
|
||||
// decrypt if was encrypted on the other side
|
||||
if c.cs.channel.fileMetaData.IsEncrypted {
|
||||
err = decryptFile(c.crocFileEncrypted, c.crocFile, passphrase)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
os.Remove(c.crocFileEncrypted)
|
||||
} else {
|
||||
c.crocFile = c.crocFileEncrypted
|
||||
}
|
||||
|
||||
// check hash
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue