mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +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
|
return
|
||||||
}
|
}
|
||||||
fd.IsCompressed = c.UseCompression
|
fd.IsCompressed = c.UseCompression
|
||||||
|
fd.IsEncrypted = c.UseEncryption
|
||||||
|
|
||||||
fd.Hash, err = hashFile(c.crocFile)
|
fd.Hash, err = hashFile(c.crocFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -204,13 +205,16 @@ func (c *Croc) processReceivedFile() (err error) {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
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)
|
err = decryptFile(c.crocFileEncrypted, c.crocFile, passphrase)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
os.Remove(c.crocFileEncrypted)
|
os.Remove(c.crocFileEncrypted)
|
||||||
|
} else {
|
||||||
|
c.crocFile = c.crocFileEncrypted
|
||||||
}
|
}
|
||||||
|
|
||||||
// check hash
|
// check hash
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue