1. Introduction to Cryptography

Guidelines for cryptographers

Never try to design your own cryptosystem. The best cryptographers in the world routinely design cryptosystems with serious security flaws. As it turns out, it’s really hard to build a secure system. There are just too many attack vectors to consider.

For a cryptosystem to be considered “secure enough” it needs to go through intense scrutiny by the security community. “Security through obscurity”, or the fact that attackers may not have knowledge of your system, is something that should never be relied on. In fact, good systems do expose to attackers how they work. Only the private keys should be kept secret.

The enemy knows the system. One ought to design systems under the assumption that the enemy will immediately gain full familiarity with them.

According to Kerckhoffs’s principle

Always take reasonable steps to protect any keys that your software systems use.

Never store encryption keys in plain text with the data they protect. That’s the virtual equivalent of locking your front door and leaving the key on the frame. It’s the first place an attacker will look.

Let’s take a look at a few rules of thumb for securely storing keys.

  1. Protect your private keys with strong access control lists, or ACLs. Follow the principle of least privilege, that is, only allow those you really need the keys to get access to them.
  2. Use a secure password or secret manager to keep track of your keys. Good secret managers will encrypt your keys using a strong key-derivation function like bcrypt or scrypt.
  3. In extreme cases, a hardware security module is a physical device that can be used to store keys offline securely. Software applications can then access HSMs connected to the same machine. The HSM actualy performs decryption on the HSM itself, so the keys never leave the device.

Lastly, ensure you only use key strengths and operating modes that comply with the latest industry best practices. For example, AES-256 should typically be used over AES-128, if for no other reason than its larger key size provides more entropy when going up against a quantum algorithm.

Leave a Reply

Your email address will not be published. Required fields are marked *