Crate octavo_crypto

Source
Expand description

Cryptosystems primitives

Cryptosystem is a suite of algorithms that describe particular security service, in most cases used for achieving confidentiality. Typically this is set of three algorithms: key generation, encryption function and decryption function.

Mathematically it can be described as tuple (P, C, K, E, D), where:

  • P is a set called “plaintext space”
  • C is a set called “ciphertext space”
  • K is a set called “key space”
  • E is a set of functions e :: k -> p -> c called “encryption functions”
  • D is a set of functions d :: k -> c -> p called “decryption functions”

For each ke ∈ K there is kd ∈ K such that d(kd, e(ke, p)) = p. If kd = ke then we call that “symmetric cipher” otherwise we call it “asymmetric cipher”.

In practise we use “asymmetric ciphers” for which computing kd from ke is computationally hard or impossible.

§Kerckhoff’s Principle

A cryptosystem should be secure even if everything about the system, except the key, is public knowledge.

This is basic law for moder cryptography. Unfortunately many of people understand this as “keeping cryptosystem hidden is bad”. That is big misunderstanding of what that principle states. It is nothing bad to keep cryptosystem in secret, it is yet another obstacle to overcome by eavesdropper, just don’t rely on secrecy.

§Key lengths

According to ECRYPT II Yearly Report on Algorithms and Keysizes this table presents key-sizes equivalence between types of algorithms:

SymmetricFactoring ModulusDiscrete LogarithmElliptic Curves
48480480/9696
56640640/112112
64816816/128128
8012481248/160160
11224322432/224224
12832483248/256256
16053125312/320320
19279367936/384384
2561542415424/512512

§Security table

Levels of security according to ECRYPT II Yearly Report on Algorithms and Keysizes

Security LevelSecurity (bits)ProtectionComment
1.32Attacks in “real-time” by individualsOnly acceptable for auth. tag size
2.64Very short-term protection against small organizationsShould not be used for confidentiality in new systems
3.72Short-term protection against medium organizations, mediumterm protection against small organizations
4.80Very short-term protection against agencies, long-term prot. against small organizationsSmallest general-purpose level, <= 4 years protection
5.96Legacy standard level2-key 3DES restricted to ~10^6 plaintext/ciphertexts, ~10 years protection
6.112Medium-term protection~20 years protection
7.128Long-term protectionGood, generic application-indep. recommendation, ~30 years protection
8.256“Foreseeable future”Good protection against quantum computers unless Shor’s algorithm applies

We recommend at least 128-bit security for general purpose.

Modules§

asymmetric
Public-key (asymmetric) cryptosystems
block
Block cryptosystems
prelude
stream
Stream cryptosystems