My messages were on my own disk and I could not read them
Signal Desktop was deregistered by the server, which cleared its credentials and made every network screen useless. The official fix, relinking, wipes the local database. How the three layers of encryption fit together, the CBC padding detail that silently truncates files, and why a count of missing files was not information.
Reportednine files missing
TrueNo pictures lost. Nine long messages shortened.
Signal Desktop broke for me in a way I had not seen before. The window opened and my conversations were there. I could scroll back years and open every photo. But every button that needed the network did nothing, and the screen that offered to fix it froze the moment I touched it.
The log explained it in one line:
DeviceDelinked: device was deregisteredSignal Desktop is a linked device, not an account of its own, and the server had unlinked it. The app responded correctly by deleting its own credentials:
unlinkAndDisconnect: Client is no longer authorized; deleting local configurationThe official fix is to link the device again. That was the last thing I wanted, because a fresh link wipes the local database and syncs from scratch. My phone's touchscreen was also dead, so I could not scan a QR code anyway.
So I was in an odd spot. Several hundred messages and 273 photos sat on an SSD I own, in my own house, and the one program that could read them had stopped working. The recommended repair would delete them.
They could still be recovered. Here is how I got them out.
Three locks
Signal Desktop encrypts at two levels, and the key to the second level is stored inside the first.
The messages live in a SQLCipher database at sql/db.sqlite. Attachments are stored outside it. Each one is its own encrypted file under attachments.noindex, and its key is a row in the database.
So you need the database key to get the attachment keys, and the database key is itself wrapped by your operating system's keyring.
Lock one: the keyring
Open config.json in the Signal profile and you find something like this:
{
"encryptedKey": "763131...",
"safeStorageBackend": "kwallet6"
}That is Electron's safeStorage, which comes from Chromium, so the format is well known to anyone who has written a Chrome cookie extractor. The first three bytes are a version tag:
v10means no OS keyring was available, so Chromium fell back to a hardcoded password, the stringpeanuts. If you see this, the key is as good as plaintext.v11means a real keyring holds the password: kwallet on KDE, libsecret on GNOME.
Mine was v11, so the password came from the wallet:
kwallet-query -f "Chromium Keys" -r "Chromium Safe Storage" kdewalletLook at the folder name. Signal stores this under Chromium's name instead of its own, because that is the code it inherited.
Lock two: the database
Whichever password you end up with, the unwrapping is the same, and the constants are strange enough to spell out:
aes_key = pbkdf2_hmac("sha1", password, b"saltysalt", 1, 16)
cipher = Cipher(algorithms.AES(aes_key), modes.CBC(b" " * 16))PBKDF2 with one iteration. A salt that is literally the string saltysalt. An initialisation vector made of sixteen spaces. This is not a flaw in Signal, since the real protection is the keyring that holds the password. It just shows that "encrypted" tells you how something is stored, and says nothing about how hard it is to open.
What comes out is 64 hexadecimal characters, and that opens the database:
cur.execute(f"PRAGMA key = \"x'{key}'\"")
cur.execute("PRAGMA cipher_compatibility = 4")The x'...' syntax is important. Without it SQLCipher treats the string as a passphrase and derives a key from it, and you get the same unhelpful "file is not a database" error a wrong password gives.
Lock three: every attachment on its own
Each file under attachments.noindex is laid out like this:
IV (16 bytes) || ciphertext || HMAC-SHA256 tag (32 bytes)The key for each file is 64 bytes of base64 in the message_attachments table. The first 32 bytes are the AES-256-CBC key and the last 32 are the MAC key. The tag covers everything before it, so you can check a file is intact before you trust any of it.
One detail cost me a while. CBC padding hides the real length. You cannot just strip the padding and trust what is left, because a file whose last byte happens to be 0x01 looks like it has one byte of padding whether it does or not. The database records the real plaintext size, so use that.
if data and 1 <= data[-1] <= 16:
data = data[: -data[-1]]
if plaintext_size and len(data) >= plaintext_size:
data = data[:plaintext_size]That was enough. 902 files came out: 273 photos and videos at full size, plus thumbnails, link previews and stickers.
Where I nearly got it wrong
The first run finished with a cheerful summary and one line near the bottom:
note: 9 attachments referenced but no longer on diskNine files gone. I could have shrugged. Ninety-eight percent recovered is a good result, and the tool had done what I asked.
But "nine files missing" told me almost nothing. Nine missing photos and nine missing scraps of text are very different outcomes, and the summary could not say which one I had.
So I asked the database what those nine were:
contentType | kind | date
text/x-signal-plain | long-message | 2026-06-13
text/x-signal-plain | long-message | 2026-06-11
text/x-signal-plain | long-message | 2026-06-14
...All nine were long-message files. Signal uses these to store the rest of a message that is too long for its database row. There was no photo among them. The accurate summary was "no pictures lost, nine long messages shortened."
Checking took about ten minutes, and afterwards I could state the result as a fact instead of worrying about it.
I changed the tool so it always makes that distinction. It now splits unrecoverable data into three groups instead of giving one count.
Never downloaded: rows with no file path at all. The attachment was in the conversation, but this computer never fetched it, so it only ever existed on the phone and the server. That was eighteen media items for me, and nothing on my disk could bring them back.
Referenced but gone: the database points at a file that is not there, usually because Signal cleaned it up. When that happens to a picture, a thumbnail often survives, so the tool now saves the thumbnail with _THUMBNAIL_ONLY in its name. A small copy is better than nothing.
Orphaned: encrypted files on disk with no database row pointing at them. No row means no key, and without the key they are just noise.
Checking the output
Every attachment carries an HMAC, so I could check the decryption instead of assuming it worked. But a matching MAC only proves the decryption matched the tag. It does not prove the result is a file anything can open.
So after extraction I decoded everything again with tools that knew nothing about how the files were made:
identify photo.jpg # ImageMagick parses the whole image
ffprobe clip.mp4 # demuxes and reads the duration851 images and 36 audio and video files, with zero failures. That says more than "the checksums matched."
What I learned
I set out to recover files and ended up learning about reporting.
A recovery tool that says "902 files recovered" is describing its own success. One that says "902 recovered, 18 never on this machine, 9 long messages shortened, 6 orphaned without keys" is describing your data. The second is harder to write, and it is the one I trust, because it says what it does not know.
When a process can partly fail, it should report its failures by type. A single number sounds reassuring, and that is exactly how it hides the thing you needed to hear.
The tool is at github.com/A-e70/signal-desktop-export, MIT licensed. It reads data you already have, on a machine you control, with a key your own keyring already holds. Without that keyring password it does nothing at all, which is how it should be.