Encrypt and compress which first




















Ferruccio If you use, for example, a block cipher in CBC mode with a random IV, then, given the same data and the same key, you will get a different random-looking result. Does any practical finite-time compression algorithm fully randomize the message?

Isn't there always a residual pattern to the compressed data that can then be used to break the encryption theoretically? Show 9 more comments. Community Bot 1 1 1 silver badge. So, is it a trade-off, then? Looks like the two choices are: 1 Encrypt, then compress for greater security but less effective compression.

Doesn't this require a known-plaintext attack to be viable against your chosen cryptographic primitive? If you want the better file size and security, compress, encrypt, then compress again. The final compression won't be able to compress anything but it will randomize the data. Or, if you prefer it the other way round: if you succeed in compressing some encrypted text, then it is high time to question the quality of the encryption algorithm… That is because the output of an encryption system should be indistinguishable from purely random data, even by a determined attacker.

Thomas Pornin Thomas Pornin Cameron Skinner Cameron Skinner Of course it matters. It's generally better to compress first and then to encrypt. Victor Stoddard Victor Stoddard 3, 2 2 gold badges 23 23 silver badges 23 23 bronze badges. The Overflow Blog. Does ES6 make JavaScript frameworks obsolete? Podcast Do polyglots have an edge when it comes to mastering programming If the encrypted file does compress, all hope is lost and you may as well hand over the plaintext to the bad guys.

Of course a block cipher in ECB mode tends to be highly compressible but then it tends not to give random output and is open to dictionary attacks. Show 3 more comments. Community Bot 1. Thomas Pornin Thomas Pornin k 57 57 gold badges silver badges bronze badges. I would recommend to first compress the data and than encrypt it. Raphael Ahrens Raphael Ahrens 2 2 silver badges 12 12 bronze badges. Dinithi Dinithi 5 5 bronze badges.

Depends a bit on the data really. Note that even uncompressed data leaks information about the size of the plaintext message. However, compression can leak information about the contents of the plaintext message as well, as some data is easier to compress than other data.

Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.

The Overflow Blog. Does ES6 make JavaScript frameworks obsolete? Podcast Do polyglots have an edge when it comes to mastering programming Matthews, Kevin Z. Snow, and Fabian Monrose. From the paper:. Many modern speech codecs are based on variants of a well-known speech coding scheme known as code-excited linear prediction CELP [49], which is in turn based on the source-filter model of speech prediction.

The source-filter model separates the audio into two signals: the excitation or source signal, as produced by the vocal cords, and the shape or filter signal, which models the shaping of the sound performed by the vocal tract. This allows for differentiation of phonemes; for instance, vowels have a periodic excitation signal while fricatives such as the [sh] and [f] sounds have an excitation signal similar to white noise [53].

In basic CELP, the excitation signal is modeled as an entry from a fixed codebook hence code-excited. The filter signal is modeled using linear prediction, i. Thus an encoded frame consists of a fixed codebook entry and gain coefficient for the excitation signal and the linear prediction coefficients for the filter signal.

Under VBR, the size of the codebook entry, and thus the size of the encoded frame, can vary based on the complexity of the input frame.

The specification for Secure RTP SRTP [3] does not alter the size of the original payload; thus encoded frame sizes are preserved across the cryptographic layer. The size of the encrypted packet therefore reflects properties of the input signal; it is exactly this correlation that our approach leverages to model phonemes as sequences of lengths of encrypted packets. 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 that got to the de-crypt keys. Most likely an inside job.

Here is the link to the news article. If one first compresses then encrypts the file, it would not be able to be restored at the other end. 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.

There is a minimum size under which compression isn't feasible at all I guess. 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. I would consider the requirements against this data transmission like: - How data is produced and feeds this process?

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. After all the considerations if there are still more options I would plan and execute tests on these possible solutions.



0コメント

  • 1000 / 1000