Asymmetric algorithms for secret key distribution
Key distribution problem
Given people, we would need 499,500 symmetric keys opposed to 2000 asymmetric keys in order to communicate between each person. This is the key distribution problem.
Link to original
We can use public-key encryption algorithms to support faster symmetric cryptography.
Distribution with RSA
Key distribution with RSA
Alice encrypts by using Bob’s public key .
- Alice randomly chooses a secret key to be shared with Bob.
- Alice sends to Bob.
Bob decrypts with his private key .
Link to original
- Bob splits into .
- Bob computes and .
SSL Protocol
Alice chooses a secret, encrypts it with Bob’s public key and rest of the session is protected based on that secret.
If the private key is compromised, then can be recovered from previously observed traffic.
Diffie-Hellman key exchange
Diffie-Hellman key exchange
Diffie-Hellman is a simple public-key algorithm that enables two users to establish a secret key using a public-key scheme based on discrete logarithms.
Link to original
- Principals share a prime number and an integer that is a primitive root of . Both and may be public, or could send them in the first message.
- and generate random numbers and both less than . (these are private keys)
- computes , computes . (these are public keys, also known as “Diffie-Hellman half keys”)
- and exchange and .
- computes , computes . (the keys are equal, i.e. )
Proof
Protocol is only secure if the authenticity of the two participants can be established.
The shared secret key is never transmitted (not even in encrypted form).
- and are the public keys.
- and are the private keys which are never shared, so the attacker can only use , , , and .
- must take a discrete logarithm to determine the key. To compute the private key of user , must compute .
Keys are unauthenticated and D-H is vulnerable to a MITM attack.
- Attacker prepares by generating two random private keys and computing the corresponding public keys.
- can intercept any communication, i.e. swap the public keys shared by and for his own.
- As such, negotiates D-H key exchange with both participants individually and then acts as a tunnel between them. Encrypted messages are sent to which are decrypted then re-encrypted for the other peer.
may also modify any message they want. We can overcome this vulnerability with the use of digital signatures and public-key certificates to achieve mutual authentication between and .
Primitive Roots
Primitive root
A primitive root of a prime number is a number whose powers generate .
So are distinct, i.e. a permutation of through .
Hence .
Link to originalDiscrete logarithm
For any integer and a primitive root of prime number , we can find a unique exponent such that where .
is called the discrete logarithm of for base , .
Link to originalComputing discrete logarithms appears infeasible today.
The security of D-H key exchange lies in the fact it is relatively easy to calculate exponentials modulo a prime but very difficult to calculate discrete logarithms.
Example of calculating secret key
Attacking the key
Group Diffie-Hellman (for principals)
Given a D-H group , three principals can together generate a secret key by:
This can be extended to principals by adding more rounds of computations to compute the key .
El Gamal variant of Diffie-Hellman key exchange
El Gamal variant of Diffie-Hellman key exchange
The El Gamal variant of Diffie-Hellman has the same setup with a public prime and generator .
Let be any symmetric encryption function. The schema is as follows:
Link to original
- chooses and computes .
- chooses integer , computes , and computes key .
- computes .
Masey-Omura scheme
Masey-Omura scheme
The Masey-Omura scheme is a scheme that enables encryption without shared keys (based on the discrete logarithm problem).
Principals share some (public) prime . Principals chooses (private) such that So . So there is a where . Hence, by Euler’s theorem, for all :
Steps go as follows:
Link to original
Message integrity and cryptographic hashes
Message integrity
Message / data integrity is the property that data has not been altered in an unauthorized manner since the time it was created, transmitted, or stored by an authorized source.
Link to original
In operating systems, access control is used to ensure data integrity. Meanwhile open networks use cryptographic means.
Hash Function
A hash function has the properties:
Link to original
- Compression: maps an input of of arbitrary bit length to an output of fixed bit length which may be smaller
- Polynomial time computable
Cryptographic hash function
A cryptographic hash function has the additional properties:
- It is one-way (preimage resistant) Given , it is hard to compute an where .
And is usually either:
Link to original
2nd-preimage resistant
2nd-preimage resistant: it is computationally infeasible to find a second input that has the same output as any specified input, i.e. given to find an such that
Link to originalCollision resistant
Collision resistant: it is difficult to find two distinct inputs where
Link to original
Message digest
The resulting hash value can also be called the message digest or modification detection code
Link to original
Collision resistance and birthday paradox
Birthday Paradox We look at how many people must be in a room such that the probability that one has your birthday is : the probability is so for . We also consider how many people must be in a room such that the probability that any two share the same birthday is : which is .
Generalisation:
- Let have possible outputs
- must be applied to inputs so that the probability of a collision is greater than
Birthday Attack One may assume a bit hash code is secure. Preimage resistance means, on average messages must be tried.
Birthday attack for finding collisions:
- Suppose is willing to sign a contract with . Then prepares version , which is good for , and version , which bankrupts them.
- generates ‘good’ messages
- And similarly generates ‘bad’
- Stops when
- signs and creates a signature which later uses for .
On average, work requires is order of . So double hash size if collision avoidance is important.
Constructing cryptographic hash function
- Simplest algorithms use block chaining techniques:
- Divide message into fixed size blocks
- Use symmetric encryption algorithm, e.g. DES
(similar to Cipher Block Chaining w/ no secret key)
- Modern algorithms are more complex
- MD5 (Message Digest by Rivest): 128-bit hashes, known weakness
- SHA (Secure Hash Algorithm; U.S. std): 160-bit hashes SHA-1 widely used but deprecated. SHA-3 still apparently secure.
Message authentication
Message authentication
Message authentication (also called data-origin authentication) is a strategy to protect the integrity of a message, ensuring that each message is received and deemed acceptable.
Link to original
Message Authentication Codes (MACs)
MAC algorithm
A MAC (Message Authentication Code) algorithm is a family of hash functions parameterised by a secret key . must be computation-resistant: given zero or more MAC pairs , it is infeasible to compute for any new input .
Link to original
Constructing MACs
![]()
Does not provide non-repudiation as a symmetric cipher is used.
Vulnerable to replay attacks.
Digital Signatures
Digital Signature
Digital Signatures are fundamental in authentication and non-repudiation.
- is a set of messages that can be signed
- is a set of elements called signatures, e.g. -bit strings
- , is a signing transformation for entity , and kept secret by .
- is a verification transformation for ‘s signature and is publicly known.
and provide a digital signature scheme for .
Link to original
Example signature schema
Signing procedure (digital signatures)
Signing procedure: creates a signature for by computing and transmits pair .
Link to original
Verification procedure (digital signatures)
Verification procedure: verifies ‘s signature of by computing , and only accepting the signature if .
Link to original
Secrecy (digital signatures)
Secrecy (digital signatures) requires it is hard for any entity other than to find, for any , an , where .
Link to original
Implementing digital signatures
![]()
Use of RSA for digital signatures
Forgery can be prevented by signing messages with a fixed structure:
- Message names its sender
- or (more typically) cryptographic hash signed, sent with the message.
Public-Key Infrastructure (PKI)
Not examined, slides lec 2. 26 - 72.



This can be extended to
(similar to Cipher Block Chaining w/ no secret key)



