2

I have some RNA-seq files need to be decrypted.

For example

1672_WTSI-OESO_005_w3.tar.gz.gpg

Likely I have key for that in same folder

1672_WTSI-OESO_005_w3.gpgkey

I have also have a file name

1672_WTSI-OESO_005_w3.md5

Inside that I have

884f9fa72fb7f6adbba95dc677eb0ec9  1672_WTSI-OESO_005_w3.tar.gz.gpg

EDITED

    [fi1d18@cyan01 fereshteh]$ gpg --decrypt --passphrase-file=1672_WTSI-OESO_036_a_RNA.gpgkey --output - 1672_WTSI-OESO_036_a_RNA.tar.gz.gpg | tar -xvzf -
gpg: CAST5 encrypted data
can't connect to `/home/fi1d18/.gnupg/S.gpg-agent': No such file or directory
gpg: encrypted with 1 passphrase
1672_WTSI-OESO_036_a_RNA/
1672_WTSI-OESO_036_a_RNA/mapped_sample/
1672_WTSI-OESO_036_a_RNA/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-OESO_036_a_RNA.dupmarked.bam.bai
1672_WTSI-OESO_036_a_RNA/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-OESO_036_a_RNA.dupmarked.bam
gpg: WARNING: message was not integrity protected

gzip: stdin: invalid compressed data--crc error

gzip: stdin: invalid compressed data--length error
tar: Skipping to next header
tar: Child returned status 1
tar: Error is not recoverable: exiting now
[fi1d18@cyan01 fereshteh]$
  • If the file were encrypted with --cipher-algo AES256 then it would have it's own "integrity protection" and gpg would know if the file were corrupted. Right now with only tar/gzip complaining, it's not obvious if the encrypted file was changed/damaged, or if it's just not a valid .tar.gz file. You could try decrypting it (without the -d option gpg should still know what to do, and with the --use-embedded-filename option might help) then examine the resulting file with tar, or even file to see what it "looks like". [Or if the md5 file is accurate, then it does appear corrupted] – Xen2050 Feb 23 at 7:02
4

The file is, according to the GnuPG output that you show, a file encrypted using the CAST5 algorithm. This is a symmetric encryption algorithm, meaning that you should just be able to use the passphrase in that .gpgkey file with gpg --decrypt to decrypt it (without importing it into your keyring; it's not that kind of key).

To decrypt the file and pass the decrypted data directly to tar for unpacking, you could use

gpg --decrypt --passphrase-file=1672_WTSI-OESO_005_w3.gpgkey --output - 1672_WTSI-OESO_005_w3.tar.gz.gpg |
tar -xvzf -

This would read the key from the provided file, decrypt the message using that key, and pass the data on to tar.

If the file 1672_WTSI-OESO_005_w3.gpgkey does not decrypt the message, then you will have to get in touch with whoever provided you with the encrypted file and ask them for instructions about how to decrypt it.

The .md5 file is used to ensure that the .gpg file contains the correct data. You can use it to verify the data like this:

md5sum -c 1672_WTSI-OESO_005_w3.md5

If this does not give the output

1672_WTSI-OESO_005_w3.tar.gz.gpg: OK

then the file is corrupt somehow, and you need a fresh copy of it from wherever you got it. If it says FAILED, then gpg and tar will not be able to decrypt and unpack the data.


The error shown at the end of the updated question (now deleted) is Cannot write: Disk quota exceeded. This means that the files extracted from the archive are too big to fit in the space allotted to your account.

To fix this, either delete or compress files no longer needed, until you have enough space to extract the archive, or talk with your system administrator(s) and have them allocate more disk space to your account.

  • Sorry for both of the solutions you mentioned a box appears saying enter passphrase – Angel Feb 22 at 15:21
  • 1
    @FereshTeh Yeah, that's what I though. You have a corrupted file. You will have to get a fresh copy of it. – Kusalananda Feb 22 at 16:24
  • 1
    @FereshTeh Cannot write: Disk quota exceeded means that you have run out of disk space. Either remove (or compress) unneeded files, or ask you system administrator(s) to allocate more space for your account. – Kusalananda Feb 22 at 18:12
  • 1
    @FereshTeh Sorry, you are changing the text in the question constantly. It's difficult to write an answer that is consistent, because with each edit you invalidate the answer I've just written. I can't answer an ever-changing question. I suggest that you check your files against the MD5 file that you also have. If that checks out ok, and if you have enough file space to store the extracted archive, it should work. You now have all the tools you need. Anything else will have to be a new question, or a matter for your system administrators. – Kusalananda Feb 22 at 18:46
  • 1
    @FereshTeh Take care, and have a good weekend. – Kusalananda Feb 22 at 19:00
2

The file is not encrypted with a public key, for which you would need a private key to decrypt anyway. So importing the key does not help you.

It is encrypted with passphrase (gpg -c ..), and hopefully the passphrase is in the gpgkey-file.

Try:

hexdump -C 1672_WTSI-OESO_005_w3.gpgkey

You should see (only) printable characters in the Output. If so, use the key to decrypt:

gpg -d 1672_WTSI-OESO_005_w3.tar.gz.gpg < 1672_WTSI-OESO_005_w3.gpgkey > 1672_WTSI-OESO_005_w3.tar.gz

This should create the file '1672_WTSI-OESO_005_w3.tar.gz'.

  • Thank you, both of your solutions likely working but not finished yet. I have added those to my edited post – Angel Feb 22 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.