1
1
Fork 0
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:
Zack Scholl 2018-07-02 08:03:23 -07:00
parent 7be11a6fda
commit efee59f541

View file

@ -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