Lecture 2 C Public Key Cryptography
Lecture 2 C Public Key Cryptography
Lecture 2 C Public Key Cryptography
Public-key cryptography algorithms that are in use today for key exchange or digital signatures
include:
RSA: The first, and still most common, PKC implementation, named for the three MIT
mathematicians who developed it — Ronald Rivest, Adi Shamir, and Leonard Adleman. RSA
today is used in hundreds of software products and can be used for key exchange, digital
signatures, or encryption of small blocks of data.
Diffie-Hellman: After the RSA algorithm was published, Diffie and Hellman came up with their
own algorithm. D-H is used for secret-key key exchange only, and not for authentication or
digital signatures.
Digital Signature Algorithm (DSA): This algorithm provides digital signature capability for the
authentication of messages.
Hash Functions
Hash functions, also called message digests and one-way encryption, are
algorithms that, in some sense, use no key.
Hash algorithms are typically used to provide a digital fingerprint of a file's
contents, often used to ensure that the file has not been altered by an intruder or
virus.
Hash functions are also commonly employed by many operating systems to
encrypt passwords. Hash functions, then, provide a measure of the integrity of a
file.
Hash Functions
Let me reiterate that hashes are one-way encryption. You cannot take a hash and
"decrypt" it to find the original string.
Hash algorithms that are in common use today include:
Message Digest (MD) algorithms: A series of byte-oriented algorithms that
Overview
Key Generation
1. Generate two large prime numbers, p and q.
2. Let n = pq.
3. Let m = (p-1) (q-1).
4. Choose a small number e, coprime to m.
5. Find d, such that de % m=1.
Publish e and n as the public key.
Publish d and n as the secret key.
RSA Algorithm
Encryption
C=Pe%n
Decryption
P=Cd%n
n = 133 n = 133
e=5 d = 65
RSA Algorithm
Communication
Encryption
P =cd %n
= 62 65 % 133
=6
And that matches the plaintext we put in at the beginning, so that algorithm
worked.
Diffie Hellman Key Exchange
The Diffie-Hellman key agreement protocol (1976) was the first practical
method for establishing a shared secret over an unsecured communication
channel.
The point is to agree on a key that two parties can use for a symmetric
encryption, in such a way that an eavesdropper cannot obtain the key.
Diffie Hellman Algorithm
2. Alice chooses a secret number a, and sends Bob (ga mod p).
3. Bob chooses a secret number b, and sends Alice (gb mod p).