Manage Learn to apply best practices and optimize your operations.

How RSA keys differ from DH/DSS keys

In this Ask the Expert Q&A, Michael Cobb, our application security expert explains how RSA and DH/DSS differ, examines the strengths and weaknesses of each, and, explains how to use the compression library Zlib.

I just made an RSA key and its size is 4096/4096. The cipher is IDEA and Hash is SHA-2 512. Is this stronger than...

my DH/DSS key with a cipher of CAST 4096/1024? Is RSA stronger than DH/DSS? I use PGP 9.0 and Kremlin with Blowfish. On PGP, I have the keys set at implicit trust and valid and the compression is ZLIB, but I am not sure what that means.

While I have seen reports about how improvements in prime factoring may make RSA keys, particularly smaller ones, less secure, I have not seen research that indicates which is more secure, given correct implementation and parameter selection. However, there are marginal performance differences you should be aware of.

DSS is faster than RSA when producing digital signatures. On the other hand, signature verification is faster with RSA. In terms of day-to-day performance, because signatures are created once, but verified many times, RSA is considered better. These subtle differences are only likely to be an issue in systems such as smart cards, or high throughput environments.

One argument for using DH/DSS keys is that their encryption and signature keys are autonomous. The DH (Diffie-Hellman) sub-key pair is used for encryption and the DSS sub-key pair is used for signatures. DSS utilizes the Digital Signature Standard from NIST, which means if someone obtains your DH private key, they would have the ability to read all the encrypted messages sent to you, but would not be able forge your signature. This is a better scenario than the loss of an RSA private key, which would allow the key holder to decrypt messages and forge signatures.

While it's easy to get caught up in theoretical speculation about the strength of different ciphers and whether the supposedly intractable problems that the RSA and DH/DSS algorithms are based on are in fact solvable, it's important to remember that the larger your key is, the more secure it is. Given your key lengths, unless the information you're encrypting is worth an enormous amount of money, it is not worth anyone's time or effort to try to crack your encrypted data as the cost would far out weigh the value of the decrypted data.

To answer your last two questions, the trust setting of a key indicates how much you trust the key owner to introduce you to users whose keys you may receive in the future. The trust setting of your private keys is automatically set to "implicit" when you create a key pair, because you obviously trust it implicitly. You can set the level of trust of other public keys to None, Marginal or Trusted. So, for example, if you receive a key from someone that was signed by an individual you have designated as trustworthy, the key will be valid even though you have not done the check yourself.

Finally, Zlib is a general-purpose, lossless data compression library used by many different programs. The ZIP option is simply Zlib with a different setting for the WindowBits parameter. PGP automatically compresses plain text and files before it encrypts them, as data compression reduces file size and transmission time and, more importantly, strengthens cryptographic security. Most cryptanalysis techniques exploit patterns found in plain text to crack the cipher. Because compression reduces these patterns in the plain text, it makes it more resistant to cryptanalysis.

More on this topic

  • Visit our resource center for news, tips and expert advice on how to encrypt messages and keep your data safe.
  • Learn the pros and cons to securing e-mail with S/MIME


This was last published in December 2005

Dig Deeper on Email and Messaging Threats-Information Security Threats