"Connection closed (Bad Signature)" on sync

Nextcloud version (eg, 20.0.5): 21.0.1
Operating system and version (eg, Ubuntu 20.04): I don’t know. It is hosted on Cloudamo and uname -a returns Linux 3.10.0-962.3.2.lve1.5.49.el7.x86_64
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.46
PHP version (eg, 7.4): 7.4.16

The issue you are facing:
When I’m trying to sync files using the Windows client, I get “Connection closed (Bad Signature)” error on some files and they aren’t synced.

Possibly relevant information: I’m trying to migrate these files from Google Drive. First I tried the Migration from “Google Integration” app but some files were corrupted (erro 500 on download). So I deleted them all and empty trash but I got some error messages on deletion although the files desappeared.

I searched this error and apparently it is related to encryption. The suggestion was to delete the files and try again, which I did (see previous paragraph).

Is this the first time you’ve seen this error? (Y/N): Y

The output of your Nextcloud log in Admin > Logging:

{"reqId":"YJCKxgsExwNKlAtBsXvbTAAAAcY","level":4,"time":"2021-05-03T23:44:07+00:00","remoteAddr":"189.61.101.89","user":"myuser","app":"webdav","method":"GET","url":"/remote.php/dav/files/myuser/Migra%C3%A7%C3%A3o%20Google%20Drive/Casamento/Casamento.xlsx","message":{"Exception":"OCP\\Encryption\\Exceptions\\GenericEncryptionException","Message":"Bad Signature","Code":0,"Trace":[{"file":"/home/nxppyudw/public_html/apps/encryption/lib/Crypto/Crypt.php","line":480,"function":"checkSignature","class":"OCA\\Encryption\\Crypto\\Crypt","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/nxppyudw/public_html/apps/encryption/lib/Crypto/Encryption.php","line":376,"function":"symmetricDecryptFileContent","class":"OCA\\Encryption\\Crypto\\Crypt","type":"->","args":["*** sensitive parameter replaced ***",null,"AES-256-CTR","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"/home/nxppyudw/public_html/lib/private/Files/Stream/Encryption.php","line":520,"function":"decrypt","class":"OCA\\Encryption\\Crypto\\Encryption","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/nxppyudw/public_html/lib/private/Files/Stream/Encryption.php","line":318,"function":"readCache","class":"OC\\Files\\Stream\\Encryption","type":"->","args":[]},{"function":"stream_read","class":"OC\\Files\\Stream\\Encryption","type":"->","args":[8192]},{"file":"/home/nxppyudw/public_html/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php","line":55,"function":"fread","args":[null,8192]},{"file":"/home/nxppyudw/public_html/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php","line":96,"function":"stream_read","class":"Icewind\\Streams\\Wrapper","type":"->","args":[8192]},{"function":"stream_read","class":"Icewind\\Streams\\CallbackWrapper","type":"->","args":[8192]},{"file":"/home/nxppyudw/public_html/3rdparty/sabre/http/lib/Sapi.php","line":112,"function":"stream_copy_to_stream","args":[null,null,49152]},{"file":"/home/nxppyudw/public_html/3rdparty/sabre/dav/lib/DAV/Server.php","line":490,"function":"sendResponse","class":"Sabre\\HTTP\\Sapi","type":"::","args":[{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/home/nxppyudw/public_html/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/home/nxppyudw/public_html/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/home/nxppyudw/public_html/apps/dav/lib/Server.php","line":332,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/home/nxppyudw/public_html/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/home/nxppyudw/public_html/remote.php","line":167,"args":["/home/nxppyudw/public_html/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/home/nxppyudw/public_html/apps/encryption/lib/Crypto/Crypt.php","Line":505,"Hint":"Assinatura ruim","CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows) mirall/3.2.1stable-Win64 (build 20210428) (Nextcloud, windows-10.0.19042 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.1.1","id":"60908ac75b7bd"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => 'my.domain.com',
  ),
  'datadirectory' => '/home/nxppyudw/nextclouddata',
  'dbtype' => 'mysql',
  'version' => '21.0.1.1',
  'overwrite.cli.url' => 'https://my.domain.com',
  'dbname' => '',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '',
  'dbpassword' => '',
  'installed' => true,
  'mysql.utf8mb4' => true,
  'default_phone_region' => 'EU',
  'maintenance' => false,
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '127.0.0.1',
    'port' => 6379,
  ),
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => '',
  'mail_domain' => '',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '',
  'mail_smtpport' => '587',
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
);

The output of your Apache/nginx/system log in /var/log/____:
I don’t have access.

I managed to solve this. I browsed through the data filesystem and I saw some old directories created by the Google Integration app. I deleted them and then the sync worked well.

I don’t know what went wrong and I was getting a little disappointed with this. I think I enabled encryption while the Google migration was running and maybe this was the problem.

Anyway, I hope this soluction can be helpful for anyone in the future.

1 Like