Can I do encryption on a compressed file and again decompress the file after decryption to get the original data?
Can i do encryption on a compressed file and again decompress the file after decryption to get the original data?
If the compression and decompression algorithms are lossless then yes.
If you are wondering about it, an example of a lossy compression system is the JPEG encoding process. The lost data is generally visually insignificant, but enables much better compression ratios. However strictly speaking an image encoded with JPEG will not produce exactly the same image after decompression.
Compression systems like zip, gzip and bzip use lossless compression.
Also note that compression is normally applied before encryption because encryption produces data that is essentially impossible to compress.