3

Something came to my mind, and I wonder if this is proper method for client-server communication, and if this method is wide-used.

On connection, client generates seed, encrypts it using asymmetric algorithm(RSA for example), and sends it to the server.

Using CSPRNG, both client and server generate array of random bytes(using the same seed known only to client and server).

When client/server communicate, it adds random byte to each byte of message depending on offset.

For example, first byte of message since begging of connection is added to first byte of random bytes array. Opposite client/server then subtracts random byte from message byte.

Is it secure method? How is it different from sending key of XTEA (for example) using asymmetric algorithm, and using symmetric algorithm(XTEA) for rest of communication?

  • 2
    So, you've just re-invented parts of TLS, but without a lot of important components that actually make it safe to use. The moral of the story is, don't try to invent your own cryptosystem, just use TLS instead. – Xander Apr 7 '16 at 13:52
2

What you are describing is known as a Stream Cipher.

As to the differences, the linked article can be cited to get you started:

Stream ciphers are often used for their speed and simplicity of implementation in hardware, and in applications where plaintext comes in quantities of unknowable length like a secure wireless connection. If a block cipher (not operating in a stream cipher mode) were to be used in this type of application, the designer would need to choose either transmission efficiency or implementation complexity, since block ciphers cannot directly work on blocks shorter than their block size. For example, if a 128-bit block cipher received separate 32-bit bursts of plaintext, three quarters of the data transmitted would be padding. Block ciphers must be used in ciphertext stealing or residual block termination mode to avoid padding, while stream ciphers eliminate this issue by naturally operating on the smallest unit that can be transmitted (usually bytes).

Another advantage of stream ciphers in military cryptography is that the cipher stream can be generated in a separate box that is subject to strict security measures and fed to other devices such as a radio set, which will perform the xor operation as part of their function. The latter device can then be designed and used in less stringent environments.

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.