2017-07-14T07:13:00Z

If you had to both encrypt and compress data during transmission, which would you do first and why?

Encrypt means to convert (information or data) into a cipher or code, especially to prevent unauthorized access.

Compression is a reduction in the number of bits needed to represent data.

So the question is, what do we do first? Encrypt or compress during data transmission?

it_user703014 - PeerSpot reviewer
Senior Web Developer at KPMG
  • 20
  • 1427
21
PeerSpot user
21 Answers
it_user570081 - PeerSpot reviewer
User at Infosys Technologies Ltd
Real User
2017-07-20T06:45:02Z
Jul 20, 2017

First compress and then encrypt.

Search for a product comparison in Application Security Tools
it_user161343 - PeerSpot reviewer
VP of Business Development at a tech services company
Consultant
2017-07-18T19:36:01Z
Jul 18, 2017

This question regarding encrypt and compress data, in which order was a good exercise. Other decision factors that you have to include in the decision process are, what are the business requirements, regulatory requirements, compliance requirements, cyber insurance requirements and the most important requirements are where is the data being stored and who will have access to it. Digital certificates, de-crypt keys and tokens have to be managed in a highly controlled environment. OneSignOn experienced a security breach in March 2017 that got to the de-crypt keys. Most likely an inside job. Here is the link to the news article.

https://krebsonsecurity.com/2017/06/onelogin-breach-exposed-ability-to-decrypt-data/

it_user633780 - PeerSpot reviewer
Engineer with 51-200 employees
User
2017-07-19T15:39:56Z
Jul 19, 2017

Compressing data assumes there is a “restoring” at the receiver’s end. Think zip/unzip a file.

If one first compresses then encrypts the file, it would not be able to be restored at the other end.

To me it makes more sense to first encrypt then compress.

Cat Moishanu

it_user248793 - PeerSpot reviewer
Security and Risk consultant at a tech services company
Consultant
2017-07-18T23:19:08Z
Jul 18, 2017

Encrypt first, then compress.

it_user144510 - PeerSpot reviewer
User at a tech services company
Consultant
2017-07-18T18:36:58Z
Jul 18, 2017

If original is plain text. I would compress and next encrypt. If original is binary. In which case compression might not reduce size much. Perhaps an extra conversion to Base64 could be added first, next compress and finally encrypt. In this case compression needs to reduce the size to (way) lower than 75 % to compensate for the expansion of the Base64 step, otherwise I wouldn't compress at all. There is a minimum size under which compression isn't feasible at all I guess.

it_user374928 - PeerSpot reviewer
Senior Information Security Advisor at a financial services firm
Real User
2017-07-18T18:15:26Z
Jul 18, 2017

First, you need to compress the data, and then to encrypt it.
Encryption of data converts the sequence into a unique set of characters, in some cases close to random distribution. Compression the unique set may not give the proper effect and the volume of transmitted data using most of the known algorithms will only be increased. The encryption, after data compression, will reduce the transmitted set.

Learn what your peers think about Checkmarx. Get advice and tips from experienced pros sharing their opinions. Updated: September 2023.
735,432 professionals have used our research since 2012.
it_user519831 - PeerSpot reviewer
Software Test Manager at a tech vendor with 51-200 employees
Vendor
2017-07-18T17:40:21Z
Jul 18, 2017

I would consider the requirements against this data transmission like:
- How data is produced and feeds this process?
- How fast and seamless transition is required?
- What is the maximum acceptable error rate?
- Size, type, structure and number of files in a package?
- Also how data will be used on the other side? E.g. if it is stored in encrypted but uncompressed format I would consider encrypt first despite the above comments.

I would also consider preferences, constraints and bottlenecks (like compressibility of files, amount of data, bandwidth, how secure connection we have, storage capacity, calculation capacity etc.) This could result surprising decisions sometimes like leaving compression out , changing the files' content or structure if possible (e.g. not including some resources in the pdf), etc.

After all the considerations if there are still more options I would plan and execute tests on these possible solutions. The results of the tests would be the base of my final decision.

it_user656115 - PeerSpot reviewer
Digital Security Integration Lead at Nestle
Real User
2017-07-18T17:27:04Z
Jul 18, 2017

Compress and then encrypt.

RJ
Founder at a tech company with 51-200 employees
Real User
2017-07-18T15:57:33Z
Jul 18, 2017

With regard to your question regarding compression and encryption, my response is included below:

"Compression followed by encryption is a practical approach for secure data transmission. Most modern block ciphers/encryption processes will reduce the data to a pseudo-random sequence of bytes that will typically yield little, if any, compression gain at all. Thus if data in encrypted first, compression is ineffective. In addition, the reduced amount of data resulting from compression decreases the computational demand of the subsequent encryption process. On the receiving end, decryption is followed by decompression."

If you have any question, feel free to reach out to me.

Best regards,

Robert

it_user617598 - PeerSpot reviewer
ICT Security Specialist with 1,001-5,000 employees
Vendor
2017-07-18T14:24:43Z
Jul 18, 2017

Hi,

There is no difference in the security provided, but because of the way compression algorithms work, it is advisable to compress first then encrypt.
Compression algorithms exploit statistical redundancies in the data. These would normally be eliminated when you encrypt it, therefore an encrypted message won’t be compressed that well.

it_user682293 - PeerSpot reviewer
Owner at a comms service provider
Vendor
2017-07-18T14:00:04Z
Jul 18, 2017

Compress then encrypt, basically compression reduces the size by removing redundancy and this in turn reduces some vector which can be used for attacks such as frequency analysis and brute force

it_user161343 - PeerSpot reviewer
VP of Business Development at a tech services company
Consultant
2017-07-18T13:34:24Z
Jul 18, 2017

Compress before you encrypt in most cases. In some cases compression can serve as a form of encryption such as VoIP.

it_user705015 - PeerSpot reviewer
Sales Engineering Manager at Hewlett Packard Enterprise
Vendor
2017-07-18T13:31:26Z
Jul 18, 2017

My suggestion is to review any solution related to Format Preserving Encryption in order to encrypt and avoid big amounts of data. After this, compression would be optional for you. Check this link: https://en.wikipedia.org/wiki/Format-preserving_encryption

it_user432561 - PeerSpot reviewer
Head of Sales with 1,001-5,000 employees
User
2017-07-18T13:11:11Z
Jul 18, 2017

I learned that if you encrypt first you will only have random data, which will limit any potential benefit from compression.

So I would say that compress before encrypt

it_user385950 - PeerSpot reviewer
Manager, Secure Systems Engineering - EISO with 1,001-5,000 employees
Vendor
2017-07-18T13:00:20Z
Jul 18, 2017

Compress then encrypt

Real User
2017-07-18T12:53:46Z
Jul 18, 2017

Hi,
Compression is based on the frequency of patterns in your data. If you encrypt first most of the patterns will be lost and the compression afterwards will not be efficient. Ex: take a text file, encrypt it then compress it, you will get a lower compression ration than if you compress then encrypt.
Same applies to video and other types of binary data.

it_user572121 - PeerSpot reviewer
Project Manager at a tech services company with 1,001-5,000 employees
Consultant
2017-07-18T12:51:37Z
Jul 18, 2017

Typically, compression is done as the first step, in order to reduce the size of the data and to reduce the patterns and repetitions that original data could have, leading to a stronger encryption due to reducing some attacks (known plaint text and others). As noted, original data could be compressed better than encrypted one, so the logical steps that perform better are compress and encrypt.

it_user687423 - PeerSpot reviewer
Security Engineer with 1,001-5,000 employees
Vendor
2017-07-18T12:51:29Z
Jul 18, 2017

Hello,

You should compress first. If you encrypt first, the file will be incompressible because the compressor won’t know what to look for in the data stream. See this article:

https://security.stackexchange.com/questions/19969/encryption-and-compression-of-data

Chris Konicki
IT Security Engineer

it_user228813 - PeerSpot reviewer
Executive Audit Methodology with 1,001-5,000 employees
Real User
2017-07-18T12:49:05Z
Jul 18, 2017

I would say you first compress the data, as to reduce the number of bytes that need to be encrypted. Given the fact that encryption is a processor intensive activity...

it_user494973 - PeerSpot reviewer
Software Quality Assurance Engineer at ITONICS GmbH
Real User
2017-07-18T12:49:03Z
Jul 18, 2017

My answer would be Compress first because If you encrypt then your data turns into (essentially) a stream of random bits. Random bits are incompressible because compression looks for patterns in the data and a random stream, by definition, has no patterns. Therefore, i believe to compress first.

Thanks,

SHANTHAMURTHY HANUMANTHARAYAPPA - PeerSpot reviewer
Assoc Quality Analyst at OptumServe Technology Services
Real User
2017-07-18T12:41:10Z
Jul 18, 2017

My answer would be encrypt first as to protect information in the transit. Compress before encryption or after encryption is same as all depends on the data size.

Related Questions
WX
Software Engineer at Neusoft
Mar 27, 2023
Hello peers, I am a Software Engineer at a large tech services company. I am currently researching network security functions. What aspects of network security are more concerning to small and medium-sized enterprises? Thank you for your help.
2 out of 5 answers
RA
Regional Director at a tech services company with 11-50 employees
Mar 23, 2023
Data breaches, malware, phishing attacks, weak passwords, insider threats, and lack of security policies are some of the most concerning aspects of network security for small and medium-sized enterprises since they may not have the same level of security measures and IT staff as larger corporations. It's important for SMEs to identify and prioritize these risks and take steps to mitigate them to protect their business and customers' data.This could include implementing strong password policies, providing security awareness training for employees, implementing firewalls and antivirus software, and regularly backing up data. In addition, SMEs should develop formalized security policies and ensure that all employees understand and follow them to maintain a secure network environment.
WM
VP of Marketing at CyGlass
Mar 24, 2023
If we are talking strictly about the network, the issue almost all SMEs suffer from is a lack of risk visibility. Consider the risks and vulnerabilities that exist in the network from ports that are unsecured to firewall rules that are no longer effective to rogue devices that are connected and no one in IT is aware. If SMEs simply closed all of these gaps effectively, they would greatly reduce the chances that they are compromised. The second area is threat visibility - meaning an actual attack unfolding.  Once an attacker - say ransomware - bypasses an endpoint, they are free to waltz around the network for weeks. I think that the latest dwell time number is over 4 weeks. Four weeks of recon, command calls, lateral movement, credential compromise, data location, etc. That is enough time to make the ransomware attack really hurt and find all the partner companies that the attacker can move to next. Most large companies have NDR in place to detect and stop attacks - greatly lowering that dwell time and damage - but SMEs cannot afford most of those tools. There are new cloud-based NDR tools that are a lot less (CyGlass), and there are great options with Managed Detection and Response (MDR) companies like Stratejm. Either path, SMEs need to deploy tools or services that watch the network for risks, vulnerabilities, and threats.
Avigayil Henderson - PeerSpot reviewer
Content Development Manager at PeerSpot
Mar 20, 2023
Hi community,  Please share your input and help out fellow peers. Thank you.
See 1 answer
Remy Ma - PeerSpot reviewer
Network Security Services at ACE Managed Securty Services
Mar 20, 2023
When it comes to security and automation, there's no such thing as too much. That's why it makes sense to take steps to automate security for your CI/CD pipeline. Automation can help reduce the time spent on manual tasks and ensure that your code is secure before it makes its way into production. Here are some tips for automating security for your CI/CD pipeline: 1. Use a static application security testing (SAST) solution to scan code for vulnerabilities. SAST solutions can help identify and fix known issues quickly and efficiently. 2. Run regular scans of your codebase using a dynamic application security testing (DAST) tool. This will help identify any new security issues in real time. 3. Use a container scanning tool to check all your images and containers for vulnerabilities or misconfigurations. This will help ensure that no malicious code can enter the pipeline. 4. Utilize an API scanner to detect potential API vulnerabilities in your applications, such as SQL injection, cross-site scripting, and parameter tampering. 5. Implement a Web Application Firewall (WAF) to protect your applications from attacks like DDoS or brute force attacks. This can help prevent attackers from accessing sensitive information.
Related Articles
Ariel Lindenfeld - PeerSpot reviewer
Director of Community at PeerSpot
Aug 21, 2022
We’re launching an annual User’s Choice Award to showcase the most popular B2B enterprise technology products and we want your vote! If there’s a technology solution that’s really impressed you, here’s an opportunity to recognize that. It’s easy: go to the PeerSpot voting site, complete the brief voter registration form, review the list of nominees and vote. Get your colleagues to vote, too! ...
Deena Nouril - PeerSpot reviewer
Tech Blogger
Aug 5, 2022
What is OWASP? The OWASP or Open Web Application Security Project is a nonprofit foundation dedicated to improving software security. It operates under an open community model, meaning that anyone can participate in and contribute to OWASP-related online chats and projects. The OWASP ensures that its offerings (online tools, videos, forums, events, etc.) remain free and are easily accessible t...
See 2 comments
Ben Arbeit - PeerSpot reviewer
Manager at a retailer with 51-200 employees
Jul 31, 2022
Thanks for this informative article.
Jairo Willian Pereira - PeerSpot reviewer
Information Security Manager at a retailer with 10,001+ employees
Aug 5, 2022
OWASP is nice, but very specific and currently limited. How about trying ISO-24772 for all?
EB
Director of Community at PeerSpot (formerly IT Central Station)
Mar 4, 2022
Hi community members, Here is our new Community Spotlight for YOU. We publish it to help you catch up on recent contributions by community members. Do you find it useful? Please comment below! Trending Top HCI in 2022 What are the main differences between XDR and SIEM? Articles Top 5 Ethernet Switches in 2022 SASE: what is it and what are the main benefits? Questions Che...
RC
Enterprise Architect at CDPL
Dec 15, 2021
Privacy Concerns in an RPA Implementation Program. The biggest concern we (as RPA solution implementors) have faced when interacting with clients and customers were: 1. Regulatory and Compliance issues. 2. InfoSec and Security issues. 3. Audit Issues. Regulatory and Compliance Issues: There is a huge penalty if the wrong data gets updated and emails are sent to customers by the regulatory...
Related Categories
Related Articles
Ariel Lindenfeld - PeerSpot reviewer
Director of Community at PeerSpot
Aug 21, 2022
PeerSpot User's Choice Award 2022
We’re launching an annual User’s Choice Award to showcase the most popular B2B enterprise technol...
Deena Nouril - PeerSpot reviewer
Tech Blogger
Aug 5, 2022
What is OWASP Top 10 in 2022
What is OWASP? The OWASP or Open Web Application Security Project is a nonprofit foundation dedi...
Download Free Report
Download our free Checkmarx Report and get advice and tips from experienced pros sharing their opinions. Updated: September 2023.
DOWNLOAD NOW
735,432 professionals have used our research since 2012.