Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
6 views26 pages

12.1 Cryptography Algorithms C

The document provides an overview of cryptography, covering its basic concepts, including cryptographic hashes, secret key encryption, and public-key encryption. It explains the CIA model (Confidentiality, Integrity, Availability) and discusses traditional and modern cryptographic algorithms, emphasizing the importance of key management and the properties of cryptographic hash functions. The document also outlines the differences between symmetric and asymmetric encryption, detailing how public and private keys function in secure communications.

Uploaded by

akaaljot.mathoda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views26 pages

12.1 Cryptography Algorithms C

The document provides an overview of cryptography, covering its basic concepts, including cryptographic hashes, secret key encryption, and public-key encryption. It explains the CIA model (Confidentiality, Integrity, Availability) and discusses traditional and modern cryptographic algorithms, emphasizing the importance of key management and the properties of cryptographic hash functions. The document also outlines the differences between symmetric and asymmetric encryption, detailing how public and private keys function in secure communications.

Uploaded by

akaaljot.mathoda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Cryptography

Algorithms

25-03-31 CMPT 201 Slides 12.1 © Dr. B. Fraser 1


Topics


What is cryptography?

What are the basics of cryptographic algorithms?
– What are cryptographic hashes?
– What is a secret key encryption?
– What is public-key encryption?

25-03-31 2
Cryptography:
The absolute basics

25-03-31 3
Context

Cryptography
– A very broad area.
– We'll focus on how to use cryptography.
– We just touch on the basics!

25-03-31 4
The CIA Model

CIA model: the classic security model.
– Confidentiality:
know it
.. Information is only disclosed to those authorized to

– Integrity:
.. only molify information in allowed ways
and only by authorized parties.
– Availability:
.. those authorized for acces are not
presented
from

Threat examples
– Against confidentiality: classified information leak -

– Against integrity: fake images/videos ~

– Against availability: Denial-of-Service (DoS) attacks↑

25-03-31 5
General Cryptography Process
t
emeryfliesin
Plain Encryption Cipher Decryption Plain
Text Text Text


=
Cryptographers invented secret codes
to hide messages from unauthorized observers.
-


Challenges:
– How can you hide a message from everyone but the intended
recipient? Incryption Algorithm
– How can the recipient know the message is authentic?
Digital Signature
Message
Authentication coar
(MAC's

25-03-31 6
ABCD: Traditional Cryptography

Traditional Cryptography:
– Secret codes, which are secret algorithms.
– E.g., Caesar Cipher: .. shiftrach letter a certain no
of
letters down the alphabet
For +1 ‘A’ becomes ‘B’.

ABCD: Which of the following is a) EBIIL TLOIA -3-letter
the cipher text from using
a 3-letter shift Caesar Cipher ~
b) KHOOR ZRUOG 3-letter

1-letter
c) IFMMP XPSME
on the plain text “Hello world”?
d) LOWOR LDHEL random


What is the problem with a secret algorithm? ei
-
e the
– When your algorithm (or code book) is compromised, attaches
.. your code is broken out
-

-
(useless) figures
the method

25-03-31 7
Modern Encryption

Algorithms are Public
– .. keys are suret which provide the security
– May-
be symmetric (secret key) or asymmetric (public key).

Why is this better?
– If algorithm or code is secret,
then if it falls into the wrong hands it means code is useless.
– If only key is private,
then if it falls into the wrong hands then
.. It rasy to replace with
is
hey new

Think of a lock: everyone knows how a lock works, but only the person with the key can open it.

25-03-31 8
Crypto Algorithm Goals

Choose an encryption algorithm such that:
– Given a key, it should be
.. Relatively racy to rmryft or drryft a
message

– Without a key, it should be


.. hard to compute (invurt) or decrypt a
message


Strength of security often based on length of key:
Longer key is more difficult to guess (by brute-force).

combinations
more possible
2566it = 1.1x1077 combe

25-03-31 9
Window of Validity
brus

Window of Validity or

.. The minimum time to compromis a cryptographic algorithm


– Must only use algorithm that have not been compromised.


Problem:
Window of validity of your crypto function
.. may
les shorter than the lifetime of your system
.

– Design systems so you can replace the crypto function easily.

system must be

Example Windows of Validity
– 1993: SHA-0 was published. flexible &

may
er
– 1995: Possible weakness was found in the SHA-0 algorithm;
replaced with SHA-1. just
es
– 2004: Published way to compromise SHA-0 over to

– 2017: Published way to compromise SHA-1 easily


swap
– ????: Published way to compromise SHA-256? out the cyftifunction

25-03-31 10
Three Types

Types of cryptography algorithms based on their keys:
– Zero keys: .. Cryptographic Hash functions
– One key: .. Secret key function (symmetric Encryption)
Two keys: .. function Casymmetric Encryption)

Public-key

25-03-31 11
Cryptographic Hash Functions
(Zero Keys)

25-03-31 12
Cryptographic Hash Functions

Suppose we have a cryptographic hash function h()
– It takes a message m of arbitrary length as input and
.. produces a smaller (short) no him)

Toy example:
h(m) = (m2) % 4321 m m in hex h(m)
AAAA (0x41414141) --> 2242
BBBB (0x42424242) --> 893
CCCC (0x43434343) --> 2558
DDDD (0x44444444) --> 2916
EEEE (0x45454545) --> 1967
FFFF (0x46464646) --> 4032
GGGG (0x47474747) --> 469
HHHH (0x48484848) --> 4241
IIII (0x49494949) --> 2385
JJJJ (0x4A4A4A4A) --> 3543
KKKK (0x4B4B4B4B) --> 3394
LLLL (0x4C4C4C4C) --> 1938

25-03-31 13
Hash Function Properties

.. rasy to compete
– It should be easy to compute h(m)

.. One way function
– Given h(x), it should be difficult to find x.
– i.e., the reverse of h() should be difficult to compute.

.. Weak collision resistance

-
Given x, it should be difficult to find x' where h(x') == h(x)
– i.e., Given a value and a hash function, it should be difficult to
find another value that produces the same hash.

.. Strong collision resistance
– It should be difficult to find
two messages x and x' where h(x) == h(x')
– i.e., given a hash function, it should be difficult to find two values
that produce the same hash.
25-03-31 14
Ideal Hash

Ideally, we want all these properties
-

for a strong cryptographic hash function.


-

– However, not all hash functions provide all these properties.


-


Example good crypto hash function: 6
SHA-256.

https://www.researchgate.net/figure/SHA-256-algorithm-block-diagram-a-SHA-256-execution-flow-including-the-
25-03-31 preprocessing_fig3_371457507 15
Private Key Cryptography
or
Symetric Key Cryptography
(One key)

25-03-31 16
Private (Symmetric) Key Crypto

-
Encryption Decryption
Plain with shared Cipher with shared Plain
Text private key Text private key Text


One key:
.. used for
rncryption
a
dicryption

key
– .. Requires a secure way to sharr the sect
– This was the only type of encryption prior to invention of
public-key in 1970's.
merino

brovem

How T ?
d

25-03-31 17
Private Key Crypto: AES

AES is an example private
key crypto algorithm
-

Need the same key to


-


encrypt and decrypt.
-

25-03-31 https://binaryterms.com/advanced-encryption-standard-aes.html 18
Public Key Crypto
or
Asymmetric Crypto
(Two keys)

25-03-31 19
Public Key Crypto (Asymmetric)
Encryption with Decryption with

00
Public Key Cipher Private Key
Plain Text Plain
Text Text
Decryption with Cipher Encryption with
Public Key Text Private Key


There are two keys:
– Public key: can be known to anybody

Used to encrypt and verify signatures (more below).
– Private key: .. should be known only to the owner
of the
hey

Used to decrypt and sign signatures (more below).

Fundamental property of public key encryption:
– .. key
When ecrypted with one key only the other
,
e un

25-03-31 20

Sender encrypts with recipient’s public key → only recipient can decrypt with their private key

Sender signs with private key → anyone can verify with sender’s public key
Generating Keys

Generating keys:
– The public and private keys are
solution
.. generated together part of
as a

hard to recuse Computation


to some very


Example approaches to generating keys
-

– Factoring very large prime numbers,


=
– Solving "Twisted Edwards
-
curves" (ed25519)
-
Z

25-03-31 https://www.researchgate.net/figure/Elliptic-Curve-Addition_fig1_284494383 21
&
Keeping Secrets und messy
warb
tonauceiver
a


Example: Keeping Secrets
– Alice wants to send a secret message to Bob

Publishe
– .. Alice Encrypts the plainleat message using Bob's

– Bob decrypts the cipher-text using his private key



Analysis
– Since only Bob knows Bob's private key,
only =
Bob can decrypt the cipher-text.
– Hence Alice and Bob can securely share the message.
-

25-03-31 22
Verifying Sender >
- wants receiver to know
thatIt was
you

Example: Verifying Sender
– Bob wants Alice to know that he sent a messages and it has
not been altered.
.. Bob
Encrypts the blain-text with his private
key

– Alice decrypts the cipher-text using Bob's public key.



Analysis
– Since only Bob knows Bob's private key,
.. Bob is the
only one who can encrypt message
a

that can be decrypted with Bob's public


– Alice knows it was Bob who created the message.
key .

25-03-31 23
-
Secret and Verified
Both
>
- we rncrypt twice


Example: Secret and Verified
Combine previous two examples.
– Alice wants to send a verified, secret message.
– .. Alice modes a
message
with her private try

Anyone can decrypt it with her public key.

But only she can encypt with it; so we know she sent it!
– .. Alice modes the result with Bob's public key .


Only Bob can decrypt it with his private key.

Analysis
– Only Bob can decrypt- the message (using his private key),
and he'll know that only Alice can create it (using her private
key). -
-

25-03-31 24
Public Key

Benefit:
– This does not require having
.. a secure key distribution mechanism
– Lots of other use cases beyond encryption / decryption

Example algorithm: RSA.
=>

25-03-31 https://www.researchgate.net/figure/RSA-Algorithm-Process_fig3_282249995 25
Summary

Cryptography
– From plain text, create cipher text that others cannot read or
change.

Types of algorithms
– 0 Keys: Hash function
– 1 Key: Symmetric encryption (private-key)

Both sides know the same secret key.
– 2 Keys: Asymmetric encryption (public-key)

You share a public key with the world.

Anyone can encrypt messages for you using this key.

Only you can decrypt messages using your secret private
key which matches the public key.

25-03-31 26

You might also like