0

I want to decrypt a text file (which happens to be an Electrum wallet file) with gpg but I get the error gpg: no valid OpenPGP data found.

I have done a quick test by encrypting a small text file and the decrypting it. gpg can do this, but I think that's because the encrypted file is in binary format. The file I want to decrypt seems to be in text format, let me explain:

If I do cat with the file I'm able to decrypt, it shows:

�       �W�a��

That's what I mean by binary format.

However, the file I actually want to decrypt shows normal characters:

ZklGMQOhbi+AG3pzBtw1gAOTJ2TUh2ngYN0...

(These are not the actual characters, I have modified them)

I'm sure that the file I want to decrypt is encrypted in AES-256-CBC, which gpg supports. I believe the problem is the format of the file to decrypt. Am I right? How can I put this file in a format that gpg understands?

1
  • gpg does NOT support AES-256-CBC. It implements OpenPGP, and all symmetric ciphers in OpenPGP, including AES-256, use a variant (modified) CFB. Another part of GnuPG, gpgsm, does support AES-256-CBC -- in S/MIME format, which is (per Doug Adams) almost completely unlike an Electrum wallet. Apr 22 at 23:59

1 Answer 1

3

When you encrypt a file, the result isn't simply the ciphertext. It's a collection of information in a tool-specific format, including data like

  • the initialization vector
  • possibly an identifier for the encryption algorithm
  • possibly an identifier for the key derivation function (which is used to turn the password you've provided into an encryption key)
  • possibly version numbers, packet lengths etc.

You cannot simply feed the file into another tool and expect that tool to understand the format. The best approach is to use the same tool that encrypted the file to decrypt it. If that's not an option, then you'll have to figure out the exact file format used for Electrum wallets and convert it into the format used by gpg. Even then you may run into the problem that Electrum uses algorithms (e. g. for key derivation) which gpg doesn't have, which would require you to essentially replicate the Electrum decryption procedure.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .