I use ssh connection encrypted and compressed.

If I use small RSA keys or very big RSA keys, what is impact on CPU load for compression, for decompression and on bandwidth (encrypted file size) ?


In SSH, RSA keys are used only during the initial connection setup. Once you are connected, size of RSA key has no consequence whatsoever on CPU and bandwidth usage for transferring files. The initial handshake uses asymmetric algorithms (RSA, Diffie-Hellman) to handle authentication and setup of a shared secret, which is then used with symmetric cryptographic algorithms to encrypt and protect the remaining of the data exchange.

During the initial connection setup, the server will send its public key to the client and compute a signature, that the client will verify. If the client wants to be authenticated with its own RSA key pair, it will also compute a signature (verified by the server) and send the public key over the wire. A 4096-bit RSA key is twice larger than a 2048-bit RSA key, and signatures have the same size as the key, so if you have a 2048-bit RSA key and changes it into a 4096-bit RSA key, then the relevant messages in the initial handshake will be enlarged by a total of 512 bytes (+256 bytes for the key itself, and +256 bytes for the signature). I repeat, this is only for the initial handshake; it changes nothing for the gigabytes of files that you thereafter sent in the connection.

As for CPU consumption: doubling the key size more-or-less multiplies by 8 the cost of generating a signature. However, there again, this cost is only for the initial connection, and a small PC can already compute hundreds of 2048-bit RSA signatures per second.

Compression is done on the data before encryption and is in no way impacted by any cryptographic element.

| improve this answer | |

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.