1
UNIT 3 – Cryptography
What is cryptography?
Cryptography is a method of protecting information and communications through the
use of codes, so that only those for whom the information is intended can read and
process it.
Cryptography is the process of encrypting and decrypting data.
Terminology
To understand the fundamentals of cryptography, you must know the meanings of
the following terms:
Algorithm: The programmatic steps used to convert an unencrypted message into
an encrypted sequence of bits that represent the message; sometimes refers to the
programsthat enable the cryptographic processes
Cipher or cryptosystem: An encryption method or process encompassing the
algorithm,key(s) or cryptovariable(s), and procedures used to perform encryption and
decryption
Ciphertext or cryptogram: The encoded message resulting from an encryption
Code: The process of converting components (words or phrases) of an unencrypted
message into encrypted components
Decipher: To decrypt, decode, or convert, ciphertext into the equivalent plaintext
Key or crypto variable: The information used in conjunction with an algorithm to
create the ciphertext from the plaintext or derive the plaintext from the ciphertext;
the key can be a series of bits used by a computer program, or it can be a
passphrase used by humans that is then converted into a series of bits used by a
computer program
Keyspace: The entire range of values that can be used to construct an individual key
Link encryption: A series of encryptions and decryptions between a number of
systems, wherein each system in a network decrypts the message sent to it and then
2
re-encrypts it using different keys and sends it to the next neighbor, and this process
continues until the message reaches the final destination
Plaintext or cleartext: The original unencrypted message, or a message that has
been successfully decrypted
Steganography: The hiding of messages—for example, within the digital encoding of
a picture or graphic
Work factor: The amount of effort (usually in hours) required to perform
cryptanalysis to decode an encrypted message when the key or algorithm (or both)
are unknown
Encipher: To encrypt, encode, or convert, plaintext into the equivalent ciphertext
Features Of Cryptography are as follows:
1. Confidentiality: Information can only be accessed by the person for whom
it is intended and no other person except him can access it.
2. Integrity: Information cannot be modified in storage or transition between
sender and intended receiver without any addition to information being
detected.
3. Non-repudiation: The creator/sender of information cannot deny his
intention to send information at later stage.
4. Authentication: The identities of sender and receiver are confirmed. As
well as destination/origin of information is confirmed.
Types Of Cryptography: In general there are three types Of cryptography:
1. Symmetric Key Cryptography: It is an encryption system where the
sender and receiver of message use a single common key to encrypt and
decrypt messages. Symmetric Key Systems are faster and simpler but the
problem is that sender and receiver have to somehow exchange key in a
secure manner. The most popular symmetric key cryptography system are
Data Encryption System(DES) and Advanced Encryption System(AES).
2. Hash Functions: There is no usage of any key in this algorithm. A hash
value with fixed length is calculated as per the plain text which makes it
impossible for contents of plain text to be recovered. Many operating
systems use hash functions to encrypt passwords.
3. Asymmetric Key Cryptography: Under this system a pair of keys is used
to encrypt and decrypt information. A receiver’s public key is used for
3
encryption and a receiver’s private key is used for decryption. Public key
and Private Key are different. Even if the public key is known by everyone
the intended receiver can only decode it because he alone know his private
key. The most popular asymmetric key cryptography algorithm is RSA
algorithm.
Applications Of Cryptography:
1. Computer passwords:
2. Digital Currencies:
3. Secure web browsing:
4. Electronic signatures:
5. Authentication:
6. Cryptocurrencies:
7. End-to-End Encryption:
Advantages
1. Access Control: Cryptography can be used for access control to ensure
that only parties with the proper permissions have access to a resource.
Only those with the correct decryption key can access the resource thanks
to encryption.
2. Secure Communication: For secure online communication, cryptography
is crucial. It offers secure mechanisms for transmitting private information
like passwords, bank account numbers, and other sensitive data over the
internet.
3. Protection against attacks: Cryptography aids in the defence against
various types of assaults, including replay and man-in-the-middle attacks.
It offers strategies for spotting and stopping these assaults.
4. Compliance with legal requirements: Cryptography can assist firms in
meeting a variety of legal requirements, including data protection and
privacy legislation.
4
Cryptanalysis
Cryptology has two parts namely, Cryptography which focuses on creating
secret codes and Cryptanalysis which is the study of the cryptographic
algorithm and the breaking of those secret codes.
The person practicing Cryptanalysis is called a Cryptanalyst.
It helps us to better understand the cryptosystems and also helps us improve the
system by finding any weak point and thus work on the algorithm to create a more
secure secret code.
For example, a Cryptanalyst might try to decipher a ciphertext to derive the
plaintext. It can help us to deduce the plaintext or the encryption key.
Cryptography is the study of conversion of plain text(readable format) to
ciphertext(non-readable format) i.e. encryption.
It is also called the study of encryption.
Cryptology, on the other hand, is the study of the conversion of plain text to
ciphertext and vice versa.
It is also called the study of encryption and decryption.
5
Sl
no. Cryptography Cryptology
1.
Cryptography is the process of
conversion of plain text to cipher
text.
Cryptology Is the process of
conversion of plain text to cipher
text and vice versa.
2.
It is also called the study of
encryption
It is also called the study of
encryption and decryption.
3. It takes place on the sender side
It takes place on the sender and
receiver side
4.
In Cryptography, sender sends the
message to receiver.
In Cryptology, both sender and
receiver send messages to each
other.
5.
Cryptography can be seen as the
child of Cryptology.
Cryptology can be seen as the parent
of Cryptography
6.
Cryptography deals with the
techniques ofsecure
communication.
Cryptology deals with the study of
secure communication.
7.
Cryptography focuses on the
practice of hiding information
Cryptology focuses on the theoretical
and mathematical aspects of
information security
8.
Cryptography involves
encryption, decryption, and
authentication techniques
Cryptology involves the study of
codes, ciphers, and cryptanalysis
9.
Cryptography is concerned with
developing algorithms and
protocols
Cryptology is concerned with
analyzing and breaking existing
encryption methods
Encryption and Decryption:
6
S.NO Encryption Decryption
1.
Encryption is the process of
converting normal message into
meaningless message.
While decryption is the process of
converting meaningless message
into its original form.
2.
Encryption is the process which
take place at sender’s end.
While decryption is the process which
take place at receiver’s end.
3.
Its major task is to convert the
plain text into cipher text.
While its main task is to convert the
cipher text into plain text.
4.
Any message can be encrypted with
either secret key or public key.
Whereas the encrypted message can
be decrypted with either secret key
or private key.
5.
In encryption process, sender sends
the data to receiver after encrypted
it.
Whereas in decryption process,
receiver receives the
information(Cipher text) and convert
into plain text.
6.
The same algorithm with the same
key is used for the encryption-
decryption process.
The only single algorithm is used for
encryption-decryption with a pair of
keys where each use for encryption
and decryption.
7
S.NO Encryption Decryption
7
Encryption is used to protect the
confidentiality of data by converting
it into an unreadable form that can
only be read by authorized parties.
Decryption is used to reverse the
encryption process and convert the
ciphertext back into plaintext.
8
The output of encryption is a
ciphertext that is unintelligible to
anyone who does not have the
decryption key.
The output of decryption is the original
plaintext message.
Shared Key and Public Key Encryption(SKIP)
SKIP uses a combination of shared key cryptography and public key
cryptography to protect messages sent between hosts.
SKIP hosts use shared traffic keys that change frequently to encrypt data sent from
one host to another.
To protect these shared traffic keys, SKIP hosts use the public key to calculate an
implicit shared secret, which they use to encrypt the shared traffic keys, keeping
network communication secure.
Shared Key Encryption
Shared key encryption uses one key to encrypt and decrypt messages.
For shared key cryptography to work, the sender and the recipient of a message
must both have the same key, which they must keep secret from everybody else.
The sender uses the shared key to encrypt a message, shown in the following
figure, and then sends the ciphertext message to the recipient.
8
Figure B-1 Sender Uses Key to Encrypt Plaintext to Ciphertext
When the ciphertext message arrives, the recipient uses the identical shared
key to decrypt the message, shown in the following figure.
Figure B-2 Recipient Uses Key to Decrypt Ciphertext to Plaintext
Shared key encryption/decryption is relatively fast.
However, since anyone with the shared key can decrypt the information, shared key
encryption requires that only the sender and recipient have access to the shared key.
Public Key Encryption
Public key encryption uses a pair of complementary keys (a public key and
a private key) to encrypt and decrypt messages.
The two keys are mathematically related such that a message encoded with one key
can only be decoded with the other key.
Although a user's public and private keys are mathematically related, knowledge of a
public key does not make it possible to calculate the corresponding private key.
9
Figure B-3 Complementary Public and Private Keys
In public key encryption systems, users make their public key available to
anyone and keep their private key secret.
When one user wants to send a private message to another user, the sender
looks up the recipient's public key and uses it to encrypt a message, as shown
in the following figure, before sending it to the recipient.
Figure B-4 Sender Uses Recipient's Public Key to Encrypt Message
When the encrypted message arrives, the recipient uses his or her private
key to decrypt the message, Because the recipient's private key is known only to
the recipient, both the sender and recipient can safely assume that no one other than
the recipient can read the message.
Figure B-5 Recipient Uses Private Key to Decrypt Message
Public key encryption algorithms are mathematically more complex than
shared key encryption algorithms.
10
As a result, public key encryption is significantly slower than shared key
encryption.
Consequently, SunScreen SKIP uses Diffie-Hellman key pairs (described in the next
section) to create a shared secret between two users, and then uses shared key
encryption to encrypt traffic traveling between the two hosts.
Caesar Cipher in Cryptography
• The Caesar cipher is a simple encryption technique that was used by
Julius Caesar to send secret messages to his allies.
• It works by shifting the letters in the plaintext message by a certain
number of positions, known as the “shift” or “key”.
• The Caesar Cipher technique is one of the earliest and simplest methods of
encryption technique. It’s simply a type of substitution cipher, i.e., each
letter of a given text is replaced by a letter with a fixed number of positions
down the alphabet. For example with a shift of 1, A would be replaced by
B, B would become C, and so on. The method is apparently named after
Julius Caesar, who apparently used it to communicate with his officials.
• Thus to cipher a given text we need an integer value, known as a shift
which indicates the number of positions each letter of the text has been
moved down.
The encryption can be represented using modular arithmetic by first
transforming the letters into numbers, according to the scheme, A = 0, B =
1,…, Z = 25. Encryption of a letter by a shift n can be described
mathematically as.
• For example, if the shift is 3, then the letter A would be replaced by the
letter D, B would become E, C would become F, and so on. The alphabet is
wrapped around so that after Z, it starts back at A.
• Here is an example of how to use the Caesar cipher to encrypt the message
“HELLO” with a shift of 3:
1. Write down the plaintext message: HELLO
2. Choose a shift value. In this case, we will use a shift of 3.
3. Replace each letter in the plaintext message with the letter that is three
positions to the right in the alphabet.
11
H becomes K (shift 3 from H)
E becomes H (shift 3 from E)
L becomes O (shift 3 from L)
L becomes O (shift 3 from L)
O becomes R (shift 3 from O)
4.The encrypted message is now “KHOOR”.
• To decrypt the message, you simply need to shift each letter back by the
same number of positions. In this case, you would shift each letter in
“KHOOR” back by 3 positions to get the original message, “HELLO”.
Examples :
Text : ABCDEFGHIJKLMNOPQRSTUVWXYZ
Shift: 23
Cipher: XYZABCDEFGHIJKLMNOPQRSTUVW
Text : ATTACKATONCE
Shift: 4
Cipher: EXXEGOEXSRGI
12
Advantages:
• Easy to implement and use thus, making suitable for beginners to learn
about encryption.
• Can be physically implemented, such as with a set of rotating disks or a set
of cards, known as a scytale, which can be useful in certain situations.
• Requires only a small set of pre-shared information.
• Can be modified easily to create a more secure variant, such as by using a
multiple shift values or keywords.
Disadvantages:
• It is not secure against modern decryption methods.
• Vulnerable to known-plaintext attacks, where an attacker has access to
both the encrypted and unencrypted versions of the same messages.
• The small number of possible keys means that an attacker can easily try all
possible keys until the correct one is found, making it vulnerable to a brute
force attack.
• It is not suitable for long text encryption as it would be easy to crack.
• It is not suitable for secure communication as it is easily broken.
• Does not provide confidentiality, integrity, and authenticity in a message.
Features of caesar cipher:
1. Substitution cipher: The Caesar cipher is a type of substitution cipher,
where each letter in the plaintext is replaced by a letter some fixed number
of positions down the alphabet.
2. Fixed key: The Caesar cipher uses a fixed key, which is the number of
positions by which the letters are shifted. This key is known to both the
sender and the receiver.
3. Symmetric encryption: The Caesar cipher is a symmetric encryption
technique, meaning that the same key is used for both encryption and
decryption.
4. Limited keyspace: The Caesar cipher has a very limited keyspace of only 26
possible keys, as there are only 26 letters in the English alphabet.
5. Vulnerable to brute force attacks: The Caesar cipher is vulnerable to brute
force attacks, as there are only 26 possible keys to try.
13
Rules for the Caesar Cipher:
1. Choose a number between 1 and 25. This will be your “shift” value.
2. Write down the letters of the alphabet in order, from A to Z.
3. Shift each letter of the alphabet by the “shift” value. For example, if the
shift value is 3, A would become D, B would become E, C would become F,
and so on.
4. Encrypt your message by replacing each letter with the corresponding
shifted letter. For example, if the shift value is 3, the word “hello” would
become “khoor”.
5. To decrypt the message, simply reverse the process by shifting each letter
back by the same amount. For example, if the shift value is 3, the
encrypted message “khoor” would become “hello”.
Algorithm for Caesar Cipher:
Input:
1. Choose a shift value between 1 and 25.
2. Write down the alphabet in order from A to Z.
3. Create a new alphabet by shifting each letter of the original alphabet by the
shift value. For example, if the shift value is 3, the new alphabet would be:
4. A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
5. Replace each letter of the message with the corresponding letter from the
new alphabet. For example, if the shift value is 3, the word “hello” would
become “khoor”.
6. To decrypt the message, shift each letter back by the same amount. For
example, if the shift value is 3, the encrypted message “khoor” would
become “hello”.
Procedure:
• Traverse the given text one character at a time .
• For each character, transform the given character as per the rule,
depending on whether we’re encrypting or decrypting the text.
• Return the new string generated.
14
Classification of Cipher/ Classification of Encryption methods
Modified Caesar Cipher Algorithm
To encrypt a message proposed algorithm requires plaintext and encryption key.
The encryption key is an integer value and it determines alphabet to be used for
substitution.
It is based on modulo twenty six arithmetic to ensure that integer value wraps round
in case encryption key supplied is more than twenty six.
Decryption follows reverse operations performed during the process of encryption. It
requires decryption key, and encrypted text.
The decryption key should be complement to the encryption key so that reverse
character substitution can be achieved.
As stated earlier, Caesar cipher simply shifts encrypted character by number of
positions. In this paper author proposed a new method, where key size is fixed as
one. In this method firstly alphabet index is checked if the alphabet index is even
then increase the value by one else the index is odd decrease the key value by one.
Furthermore, the characters of the encrypted text arescrambled in such a way that if
an attempt is made to decrypt the cipher text it would not be easy to decrypt the
text.
15
Encryption Algorithm
Step1: Take the plain text as input.
Step2: Firstly alphabet index is checked if the alphabet index is even then
increase the value by one else decrease the key value by one.
Step3: Get the encrypted text.
Decryption Algorithm
Step 1: Insert cipher text.
Step2: Check alphabet index if the alphabet index is even then increase the
value by one else decrease the key value by one.
Step 3: Get the plain text.
16
Encryption
C=E (P) = (P+1) if P is even or zero than add one
Else
E (P) = (P-1) (mod 26) if p is odd than subtract one
Decryption
P=D(C) =(C-1) if C is odd than Subtract one
Else
D(C) = (C+1) if P is even or zero than add one
A. Encryption
Step 1: Suppose original message is Computer123
Step 2: Now apply Caesar cipher to encrypt the plain text. Shifting the key
as one.
Example 1 - Encryption process
Plaintext : Computer123
Cipher Text: Dpnovsfq214
We get Dpnovsfq214 as cipher text because as per as algorithm the value C
that is 2 is even (Refer to table 4) and we have to add one as per algorithm
and we get D as cipher text of C. same way o is even and we add one and
then p became cipher text of o.
Decryption Process
Cipher Text : Dpnovsfq214
Plaintext : Computer123
We get Computer123 as Plain Text because according to algorithm D is odd
(Refer to table 4) and we have to Subtract one as per algorithm and we get
17
C as Plain Text of D. Same way p is odd and we subtract one and then o
became plaintext of p.
Encryption Decryption
Transposition cipher
A transposition cipher is a method of encryption in which the positions of the
letters in the plaintext are rearranged to create the ciphertext. It does not
involve any substitution of letters, only the rearrangement of their positions.
18
For example, if the plaintext is “HELLO” and the key is 2, the letters might
be rearranged like this “LEHOL”.
Transposition techniques
The various types of transposition cipher are: –
1. Rail fence technique
2. Simple columnar transposition technique (SCTT)
3. Vernam Cipher (One Time Pad)
4. Book cipher/ Running key cipher
Simple columnar transposition techniques
The simple columnar transposition technique can be categorized into two
parts – Basic technique and multiple rounds.
Simples columnar transposition technique – basic technique. The simple
columnar transposition technique simply arranges the plain text in a
sequence of rows of a rectangle and reads it in a columnar manner.
How does this algorithm work?
Step 1: Write all the characters of plain text message row by row in a
rectangle of predefined size.
Step 2: Read the message in a columnar manner, i.e. column by column.
Note: For reading the message, it needs not to be in the order of columns. It
can happen in any random sequence.
Step 3: The resultant message is ciphertext.
Example: Let’s assume that Plain text is a corporate bridge, and we need to
calculate the cipher text using a simple columnar transposition technique.
19
Let’s take 6 columns and arrange the plain text in a row-wise manner.
Decide the column order for reading the message – let’s assume 1,3,5,2,4,6
is an order.
Now read the message in a columnar manner using the decided order. –
cadreeorotgpbri
cadreeorotgpbri is a ciphertext.
Simple columnar transposition technique – Multiple rounds
Simple columnar transposition technique with multiple rounds is the same as
basic; only the difference is that we iterate the process multiple times in
multiple rounds.
Working of an algorithm
Step 1: Write all the characters of plain text message row by row in a
rectangle of predefined size.
Step 2: Read the message in a columnar manner, i.e. column by column.
Note: For reading the message, it needs not to be in the order of columns. It
can happen in any random sequence.
Step 3: The resultant message is ciphertext.
Step 4: Repeat the procedure from step 1 to step 3 many times as desired.
20
Example: Let’s assume that Plain text is a corporate bridge, and we need to
calculate the cipher text using a simple columnar transposition technique.
Let’s take 6 columns and arrange the plain text in a row-wise manner.
Decide the column order for reading the message – let’s assume 1,3,5,2,4,6
is an order.
Now read the message in a columnar manner using the decided order. –
cadreeorotgpbri
cadreeorotgpbri is a ciphertext.
Let’s perform step 1 to step 3 one more time.
In the second iteration, the order of the columns will be the same.
Ciphertext – cobdoiegarrrtep
Continue the same procedure if more iteration is required.
21
What is Steganography?
Steganography is the practice of hiding a secret message inside
of (or even on top of) something that is not secret. That something
can be just about anything you want.
Steganography attempts to hide a message within another object. Not only
does steganography seek to make this information harder to understand, but
it also seeks to conceal that a message is being sent in the first place.
Examples of Steganography
Steganography has been in use for centuries. Basic physical forms of
steganography include invisible ink that can only be read by exposing it to
heat and messages written under the postage stamps of an envelope.
What Are the 5 Types of Steganography?
1. Text steganography
Text steganography conceals a secret message inside a piece of text. The
simplest version of text steganography might use the first letter in each
sentence to form the hidden message. Other text steganography techniques
might include adding meaningful typos or encoding information through
punctuation.
2. Image steganography
In image steganography, secret information is encoded within a digital
image. This technique relies on the fact that small changes in image color or
noise are very difficult to detect with the human eye. For example, one
image can be concealed within another by using the least significant bits of
each pixel in the image to represent the hidden image instead.
22
3. Video steganography
Video steganography is a more sophisticated version of image
steganography that can encode entire videos. Because digital videos are
represented as a sequence of consecutive images, each video frame can
encode a separate image, hiding a coherent video in plain sight.
4. Audio steganography
Audio files, like images and videos, can be used to conceal information. One
simple form of audio steganography is “backmasking,” in which secret
messages are played backwards on a track (requiring the listener to play the
entire track backwards). More sophisticated techniques might involve the
least significant bits of each byte in the audio file, similar to image
steganography.
5. Network steganography
Last but not least, network steganography is a clever digital steganography
technique that hides information inside network traffic. For example, data
can be concealed within the TCP/IP headers or payloads of network packets.
The sender can even impart information based on the time between sending
different packets.
How steganography works
Steganography works by concealing information in a way that avoids
suspicion. One of the most prevalent techniques is called ‘least significant
bit’ (LSB) steganography. This involves embedding the secret information in
the least significant bits of a media file. For example:
In an image file, each pixel is made up of three bytes of data corresponding
to the colors red, green, and blue. Some image formats allocate an
additional fourth byte to transparency, or ‘alpha’.
23
LSB steganography alters the last bit of each of those bytes to hide one bit
of data. So, to hide one megabyte of data using this method, you would
need an eight-megabyte image file.
Modifying the last bit of the pixel value doesn’t result in a visually
perceptible change to the picture, which means that anyone viewing the
original and the steganographically-modified images won’t be able to tell the
difference.
Symmetric cryptography
With symmetric cryptography (or symmetric-key encryption), the same key
is used for both encryption and decryption as shown in Figure 1.
24
Figure 1. Symmetric key encryption
Symmetric key ciphers are valuable because:
• It is relatively inexpensive to produce a strong key for these ciphers.
• The keys tend to be much smaller for the level of protection they
afford.
• The algorithms are relatively inexpensive to process.
What is Symmetric Cryptography?
Definition: A cryptographic key that is used to perform both the
cryptographic operation and its inverse, such as encrypting and decrypting
or creating and verifying a message authentication code. This means that
the same key is required in order to perform both functions.
Symmetric Cryptography explained
Symmetric cryptography is a single cryptographic key that is used with a
symmetric-key cryptographic algorithm and is uniquely associated with one
or more entities and is not made public (i.e., the key is kept secret).
A symmetric key is often called a secret key. The use of the term “secret” in
this context does not imply a level of secrecy, but rather implies the need to
protect the key from disclosure.
Symmetric encryption is often used for bulk encryption of large amounts of
data. It is also largely used to secure data at rest. Some examples are:
• Banking - Payment transactions, such as card payment information
• Data storage- encrypting data stored on a device when that data is not
being transferred
• Validating the message of the sender
• Random number generation
25
Implementing symmetric cryptography (particularly with hardware) can be
highly effective because you do not experience any significant time delay as
a result of the encryption and decryption.
One of the primary challenges of symmetric encryption, known as the "key
distribution problem," is distributing the key in a secure manner. The key is
essential in symmetric cryptography, and we cannot afford to lose or
misplace it. Malicious actors can decrypt the message if the individual keys
are lost or misplaced. This is why, for data in motion, asymmetric
cryptography should be used.
What is Asymmetric Cryptography?
Definition: Asymmetric cryptography is a cryptographic system in
which each user has a private key that is kept secret and is used to
generate a public key (which is freely provided to others). Users can
use their private key to digitally sign data, and the resulting
signature can be verified by anyone who has the corresponding
public key.
Asymmetric Cryptography explained
Asymmetric encryption uses one key - the public key, to encrypt, and a
different but mathematically related key - the private key, to decrypt. These
keys work as a matched set (or a ‘key pair’).
If the only thing known is the public key, determining the private key is
computationally impossible. As a result, the public key can be distributed
widely while the private key remains private and secure.
This interdependence provides a variety of benefits, the most important of
which are most likely digital signatures.
26
Digital signatures are used to ensure that a message was created by a
specific entity and to authenticate remote systems or users, among other
things.
Private keys are not shared and can be stored in the software or operating
system that is used, or on hardware such as a hardware security module
(HSM) that provides higher levels of data security and trust.
Asymmetric cryptography is also referred to as public key cryptography.
How does asymmetric cryptography work?
Asymmetric encryption uses a mathematically related pair of keys for
encryption and decryption: a public key and a private key. If the public key
is used for encryption, then the related private key is used for decryption. If
the private key is used for encryption, then the related public key is used for
decryption.
The two participants in the asymmetric encryption workflow are the sender
and the receiver. Each has its own pair of public and private keys. First, the
sender obtains the receiver's public key. Next, the plaintext message is
encrypted by the sender using the receiver's public key. This creates
ciphertext. The ciphertext is sent to the receiver, who decrypts it with their
private key, returning it to legible plaintext.
Because of the one-way nature of the encryption function, one sender is
unable to read the messages of another sender, even though each has the
public key of the receiver.
27
Uses of asymmetric cryptography
Asymmetric cryptography is typically used to authenticate data using digital
signatures. A digital signature is a mathematical technique used to validate
the authenticity and integrity of a message, software or digital document. It
is the digital equivalent of a handwritten signature or stamped seal.
Based on asymmetric cryptography, digital signatures can provide
assurances of evidence to the origin, identity and status of an electronic
document, transaction or message, as well as acknowledge informed consent
by the signer.
Asymmetric cryptography can also be applied to systems in which many
users may need to encrypt and decrypt messages, including:
Encrypted email. A public key can be used to encrypt a message and a
private key can be used to decrypt it.
SSL/TLS. Establishing encrypted links between websites and browsers also
makes use of asymmetric encryption.
Cryptocurrencies. Bitcoin and other cryptocurrencies rely on asymmetric
cryptography. Users have public keys that everyone can see and private keys
that are kept secret. Bitcoin uses a cryptographic algorithm to ensure only
legitimate owners can spend the funds.
28
Symmetric Key Encryption:
Encryption is a process to change the form of any message in order to
protect it from reading by anyone. In Symmetric-key encryption the
message is encrypted by using a key and the same key is used to decrypt
the message which makes it easy to use but less secure. It also requires a
safe method to transfer the key from one party to another.
WHAT IS SYMMETRIC ENCRYPTION?
Symmetric encryption is a type of encryption key management solution
where only one key (a secret key) is used to both encrypt and decrypt
electronic data. The entities communicating via symmetric encryption must
exchange the key so that it can be used in the decryption process. This
encryption method differs from asymmetric encryption where a pair of keys -
one public and one private - is used to encrypt and decrypt messages.
29
here are two types of symmetric encryption algorithms:
Block algorithms. Set lengths of bits are encrypted in blocks of electronic
data with the use of a specific secret key. As the data is being encrypted, the
system holds the data in its memory as it waits for complete blocks.
Stream algorithms. Data is encrypted as it streams instead of being retained
in the system’s memory.
Some examples of symmetric encryption algorithms include:
AES (Advanced Encryption Standard)
DES (Data Encryption Standard)
IDEA (International Data Encryption Algorithm)
Blowfish (Drop-in replacement for DES or IDEA)
RC4 (Rivest Cipher 4)
RC5 (Rivest Cipher 5)
RC6 (Rivest Cipher 6)
30
Asymmetric Key Encryption:
Asymmetric Key Encryption is based on public and private key encryption
techniques. It uses two different key to encrypt and decrypt the message. It
is more secure than the symmetric key encryption technique but is much
slower.
What is Asymmetric Encryption?
Asymmetric encryption, also known as public-key cryptography, is a type of
encryption that uses a pair of keys to encrypt and decrypt data. The pair of
keys includes a public key, which can be shared with anyone, and a private
key, which is kept secret by the owner. In asymmetric encryption, the sender
uses the recipient’s public key to encrypt the data. The recipient then uses
their private key to decrypt the data. This approach allows for secure
communication between two parties without the need for both parties to
have the same secret key.
31
Advantages of Asymmetric Encryption
Asymmetric encryption also known as public key cryptography is a method
of cryptography that uses two different keys to encrypt and decrypt data,
here are some advantages of asymmetric encryption: –
Enhanced Security: Asymmetric encryption provides a higher level of
security compared to symmetric encryption where only one key is used for
both encryption and decryption with asymmetric encryption a different key is
used for each process and the private key used for decryption is kept secret
by the receiver making, it harder for an attacker to intercept and decrypt the
data.
Authentication: Asymmetric encryption can be used for authentication
purposes which means that the receiver can verify the sender s identity. This
is achieved by the sender encrypting a message with their private key which
can only be decrypted with their public key if the receiver can successfully
decrypt the message, it proves that it was sent by the sender who has the
corresponding private key.
Non-repudiation: Asymmetric encryption also provides non-repudiation
which means that the sender cannot deny sending a message or altering its
32
contents this is because the message is encrypted with the sender s private
key and only their public key can decrypt it . Therefore, the receiver can be
sure that the message was sent by the sender and has not been tampered
with.
Key distribution: Asymmetric encryption eliminates the need for a secure
key distribution system that is required in symmetric encryption with
symmetric encryption, the same key is used for both encryption and
decryption and the key needs to be securely shared between the sender and
the receiver asymmetric encryption, on the other hand, allows the public key
to be shared openly and the private key is kept secret by the receiver.
Versatility: Asymmetric encryption can be used for a wide range of
applications including secure email communication online banking
transactions and e-commerce it is also used to secure SSL/TSL connections
which are commonly used to secure internet traffic.
The main features of asymmetric encryption (also known as public-key
cryptography) are:
Dual keys: Asymmetric encryption uses a pair of keys, including a public
key and a private key. The public key can be freely shared with anyone,
while the private key is kept secret and known only to the key owner.
Encryption and decryption: Asymmetric encryption uses the public key to
encrypt data and the private key to decrypt data. This allows secure
communication between two parties without the need to exchange secret
keys.
Digital signatures: Asymmetric encryption enables the creation of digital
signatures, which can be used to verify the authenticity of data. A digital
signature is created by encrypting a hash of the data with the sender’s
private key.
33
Secure key exchange: Asymmetric encryption allows for secure key
exchange, which is a critical feature in secure communication. For example,
the Diffie-Hellman key exchange algorithm uses asymmetric encryption to
establish a shared secret key between two parties without exchanging the
key itself.
Security: Asymmetric encryption is considered more secure than symmetric
encryption because it eliminates the need to exchange secret keys, which
can be a security risk. Additionally, the private key is kept secret, which
makes it harder for attackers to intercept or tamper with the data.
Slow processing: Asymmetric encryption is slower than symmetric
encryption because it involves more complex mathematical operations. This
can make it less suitable for applications that require fast data processing.
Symmetric Key Encryption Asymmetric Key Encryption
It only requires a single key for both
encryption and decryption.
It requires two keys, a public key
and a private key, one to encrypt
and the other one to decrypt.
The size of cipher text is the same
or smaller than the original plain
text.
The size of cipher text is the same
or larger than the original plain
text.
The encryption process is very fast. The encryption process is slow.
It is used when a large amount of
data is required to transfer.
It is used to transfer small amounts
of data.
It only provides confidentiality. It provides confidentiality,
34
Symmetric Key Encryption Asymmetric Key Encryption
authenticity, and non-repudiation.
The length of key used is 128 or 256
bits
The length of key used is 2048 or
higher
In symmetric key encryption,
resource utilization is low as
compared to asymmetric key
encryption.
In asymmetric key encryption,
resource utilization is high.
It is efficient as it is used for
handling large amount of data.
It is comparatively less efficient as
it can handle a small amount of
data.
The Mathematical Representation is
as follows-
P = D (K, E(K, P))
where K –> encryption and
decryption key
P –> plain text
D –> Decryption
E(K, P) –> Encryption of plain text
using K
The Mathematical Representation is
as follows-
P = D(Kd, E (Ke,P))
where Ke –> encryption key
Kd –> decryption key
D –> Decryption
E(Ke, P) –> Encryption of plain text
using encryption key Ke. P –> plain
text
Examples: 3DES, AES, DES and RC4
Examples: Diffie-Hellman, ECC, El
Gamal, DSA and RSA
35
Data encryption standard (DES)
What is DES?
The Data Encryption Standard (DES) is a symmetric-key block cipher
published by the National Institute of Standards and Technology
(NIST).
DES is an implementation of a Feistel Cipher. It uses 16 round Feistel
structure. The block size is 64-bit. Though, key length is 64-bit, DES has an
effective key length of 56 bits, since 8 of the 64 bits of the key are not used
by the encryption algorithm (function as check bits only).
General Structure of DES is depicted in the following illustration –
Since DES is based on the Feistel Cipher, all that is required to specify DES is
−
36
• Round function
• Key schedule
• Any additional processing − Initial and final permutation
Initial and Final Permutation
The initial and final permutations are straight Permutation boxes (P-boxes)
that are inverses of each other. They have no cryptography significance in
DES. The initial and final permutations are shown as follows –
Round Function
The heart of this cipher is the DES function, f. The DES function applies a
48-bit key to the rightmost 32 bits to produce a 32-bit output.
37
Expansion Permutation Box − Since right input is 32-bit and round key is
a 48-bit, we first need to expand right input to 48 bits. Permutation logic is
graphically depicted in the following illustration –
XOR (Whitener). − After the expansion permutation, DES does XOR
operation on the expanded right section and the round key. The round key is
used only in this operation.
Substitution Boxes. − The S-boxes carry out the real mixing (confusion).
DES uses 8 S-boxes, each with a 6-bit input and a 4-bit output. Refer the
following illustration –
38
Straight Permutation − The 32 bit output of S-boxes is then subjected to
the straight permutation with rule
Key Generation
The round-key generator creates sixteen 48-bit keys out of a 56-bit cipher
key. The process of key generation is depicted in the following illustration –
39
The logic for Parity drop, shifting, and Compression P-box is given in the DES
description.
DES Analysis
The DES satisfies both the desired properties of block cipher. These two
properties make cipher very strong.
Avalanche effect − A small change in plaintext results in the very great
change in the ciphertext.
Completeness − Each bit of ciphertext depends on many bits of plaintext.

UNIT 3 Information Security Sharad Institute

  • 1.
    1 UNIT 3 –Cryptography What is cryptography? Cryptography is a method of protecting information and communications through the use of codes, so that only those for whom the information is intended can read and process it. Cryptography is the process of encrypting and decrypting data. Terminology To understand the fundamentals of cryptography, you must know the meanings of the following terms: Algorithm: The programmatic steps used to convert an unencrypted message into an encrypted sequence of bits that represent the message; sometimes refers to the programsthat enable the cryptographic processes Cipher or cryptosystem: An encryption method or process encompassing the algorithm,key(s) or cryptovariable(s), and procedures used to perform encryption and decryption Ciphertext or cryptogram: The encoded message resulting from an encryption Code: The process of converting components (words or phrases) of an unencrypted message into encrypted components Decipher: To decrypt, decode, or convert, ciphertext into the equivalent plaintext Key or crypto variable: The information used in conjunction with an algorithm to create the ciphertext from the plaintext or derive the plaintext from the ciphertext; the key can be a series of bits used by a computer program, or it can be a passphrase used by humans that is then converted into a series of bits used by a computer program Keyspace: The entire range of values that can be used to construct an individual key Link encryption: A series of encryptions and decryptions between a number of systems, wherein each system in a network decrypts the message sent to it and then
  • 2.
    2 re-encrypts it usingdifferent keys and sends it to the next neighbor, and this process continues until the message reaches the final destination Plaintext or cleartext: The original unencrypted message, or a message that has been successfully decrypted Steganography: The hiding of messages—for example, within the digital encoding of a picture or graphic Work factor: The amount of effort (usually in hours) required to perform cryptanalysis to decode an encrypted message when the key or algorithm (or both) are unknown Encipher: To encrypt, encode, or convert, plaintext into the equivalent ciphertext Features Of Cryptography are as follows: 1. Confidentiality: Information can only be accessed by the person for whom it is intended and no other person except him can access it. 2. Integrity: Information cannot be modified in storage or transition between sender and intended receiver without any addition to information being detected. 3. Non-repudiation: The creator/sender of information cannot deny his intention to send information at later stage. 4. Authentication: The identities of sender and receiver are confirmed. As well as destination/origin of information is confirmed. Types Of Cryptography: In general there are three types Of cryptography: 1. Symmetric Key Cryptography: It is an encryption system where the sender and receiver of message use a single common key to encrypt and decrypt messages. Symmetric Key Systems are faster and simpler but the problem is that sender and receiver have to somehow exchange key in a secure manner. The most popular symmetric key cryptography system are Data Encryption System(DES) and Advanced Encryption System(AES). 2. Hash Functions: There is no usage of any key in this algorithm. A hash value with fixed length is calculated as per the plain text which makes it impossible for contents of plain text to be recovered. Many operating systems use hash functions to encrypt passwords. 3. Asymmetric Key Cryptography: Under this system a pair of keys is used to encrypt and decrypt information. A receiver’s public key is used for
  • 3.
    3 encryption and areceiver’s private key is used for decryption. Public key and Private Key are different. Even if the public key is known by everyone the intended receiver can only decode it because he alone know his private key. The most popular asymmetric key cryptography algorithm is RSA algorithm. Applications Of Cryptography: 1. Computer passwords: 2. Digital Currencies: 3. Secure web browsing: 4. Electronic signatures: 5. Authentication: 6. Cryptocurrencies: 7. End-to-End Encryption: Advantages 1. Access Control: Cryptography can be used for access control to ensure that only parties with the proper permissions have access to a resource. Only those with the correct decryption key can access the resource thanks to encryption. 2. Secure Communication: For secure online communication, cryptography is crucial. It offers secure mechanisms for transmitting private information like passwords, bank account numbers, and other sensitive data over the internet. 3. Protection against attacks: Cryptography aids in the defence against various types of assaults, including replay and man-in-the-middle attacks. It offers strategies for spotting and stopping these assaults. 4. Compliance with legal requirements: Cryptography can assist firms in meeting a variety of legal requirements, including data protection and privacy legislation.
  • 4.
    4 Cryptanalysis Cryptology has twoparts namely, Cryptography which focuses on creating secret codes and Cryptanalysis which is the study of the cryptographic algorithm and the breaking of those secret codes. The person practicing Cryptanalysis is called a Cryptanalyst. It helps us to better understand the cryptosystems and also helps us improve the system by finding any weak point and thus work on the algorithm to create a more secure secret code. For example, a Cryptanalyst might try to decipher a ciphertext to derive the plaintext. It can help us to deduce the plaintext or the encryption key. Cryptography is the study of conversion of plain text(readable format) to ciphertext(non-readable format) i.e. encryption. It is also called the study of encryption. Cryptology, on the other hand, is the study of the conversion of plain text to ciphertext and vice versa. It is also called the study of encryption and decryption.
  • 5.
    5 Sl no. Cryptography Cryptology 1. Cryptographyis the process of conversion of plain text to cipher text. Cryptology Is the process of conversion of plain text to cipher text and vice versa. 2. It is also called the study of encryption It is also called the study of encryption and decryption. 3. It takes place on the sender side It takes place on the sender and receiver side 4. In Cryptography, sender sends the message to receiver. In Cryptology, both sender and receiver send messages to each other. 5. Cryptography can be seen as the child of Cryptology. Cryptology can be seen as the parent of Cryptography 6. Cryptography deals with the techniques ofsecure communication. Cryptology deals with the study of secure communication. 7. Cryptography focuses on the practice of hiding information Cryptology focuses on the theoretical and mathematical aspects of information security 8. Cryptography involves encryption, decryption, and authentication techniques Cryptology involves the study of codes, ciphers, and cryptanalysis 9. Cryptography is concerned with developing algorithms and protocols Cryptology is concerned with analyzing and breaking existing encryption methods Encryption and Decryption:
  • 6.
    6 S.NO Encryption Decryption 1. Encryptionis the process of converting normal message into meaningless message. While decryption is the process of converting meaningless message into its original form. 2. Encryption is the process which take place at sender’s end. While decryption is the process which take place at receiver’s end. 3. Its major task is to convert the plain text into cipher text. While its main task is to convert the cipher text into plain text. 4. Any message can be encrypted with either secret key or public key. Whereas the encrypted message can be decrypted with either secret key or private key. 5. In encryption process, sender sends the data to receiver after encrypted it. Whereas in decryption process, receiver receives the information(Cipher text) and convert into plain text. 6. The same algorithm with the same key is used for the encryption- decryption process. The only single algorithm is used for encryption-decryption with a pair of keys where each use for encryption and decryption.
  • 7.
    7 S.NO Encryption Decryption 7 Encryptionis used to protect the confidentiality of data by converting it into an unreadable form that can only be read by authorized parties. Decryption is used to reverse the encryption process and convert the ciphertext back into plaintext. 8 The output of encryption is a ciphertext that is unintelligible to anyone who does not have the decryption key. The output of decryption is the original plaintext message. Shared Key and Public Key Encryption(SKIP) SKIP uses a combination of shared key cryptography and public key cryptography to protect messages sent between hosts. SKIP hosts use shared traffic keys that change frequently to encrypt data sent from one host to another. To protect these shared traffic keys, SKIP hosts use the public key to calculate an implicit shared secret, which they use to encrypt the shared traffic keys, keeping network communication secure. Shared Key Encryption Shared key encryption uses one key to encrypt and decrypt messages. For shared key cryptography to work, the sender and the recipient of a message must both have the same key, which they must keep secret from everybody else. The sender uses the shared key to encrypt a message, shown in the following figure, and then sends the ciphertext message to the recipient.
  • 8.
    8 Figure B-1 SenderUses Key to Encrypt Plaintext to Ciphertext When the ciphertext message arrives, the recipient uses the identical shared key to decrypt the message, shown in the following figure. Figure B-2 Recipient Uses Key to Decrypt Ciphertext to Plaintext Shared key encryption/decryption is relatively fast. However, since anyone with the shared key can decrypt the information, shared key encryption requires that only the sender and recipient have access to the shared key. Public Key Encryption Public key encryption uses a pair of complementary keys (a public key and a private key) to encrypt and decrypt messages. The two keys are mathematically related such that a message encoded with one key can only be decoded with the other key. Although a user's public and private keys are mathematically related, knowledge of a public key does not make it possible to calculate the corresponding private key.
  • 9.
    9 Figure B-3 ComplementaryPublic and Private Keys In public key encryption systems, users make their public key available to anyone and keep their private key secret. When one user wants to send a private message to another user, the sender looks up the recipient's public key and uses it to encrypt a message, as shown in the following figure, before sending it to the recipient. Figure B-4 Sender Uses Recipient's Public Key to Encrypt Message When the encrypted message arrives, the recipient uses his or her private key to decrypt the message, Because the recipient's private key is known only to the recipient, both the sender and recipient can safely assume that no one other than the recipient can read the message. Figure B-5 Recipient Uses Private Key to Decrypt Message Public key encryption algorithms are mathematically more complex than shared key encryption algorithms.
  • 10.
    10 As a result,public key encryption is significantly slower than shared key encryption. Consequently, SunScreen SKIP uses Diffie-Hellman key pairs (described in the next section) to create a shared secret between two users, and then uses shared key encryption to encrypt traffic traveling between the two hosts. Caesar Cipher in Cryptography • The Caesar cipher is a simple encryption technique that was used by Julius Caesar to send secret messages to his allies. • It works by shifting the letters in the plaintext message by a certain number of positions, known as the “shift” or “key”. • The Caesar Cipher technique is one of the earliest and simplest methods of encryption technique. It’s simply a type of substitution cipher, i.e., each letter of a given text is replaced by a letter with a fixed number of positions down the alphabet. For example with a shift of 1, A would be replaced by B, B would become C, and so on. The method is apparently named after Julius Caesar, who apparently used it to communicate with his officials. • Thus to cipher a given text we need an integer value, known as a shift which indicates the number of positions each letter of the text has been moved down. The encryption can be represented using modular arithmetic by first transforming the letters into numbers, according to the scheme, A = 0, B = 1,…, Z = 25. Encryption of a letter by a shift n can be described mathematically as. • For example, if the shift is 3, then the letter A would be replaced by the letter D, B would become E, C would become F, and so on. The alphabet is wrapped around so that after Z, it starts back at A. • Here is an example of how to use the Caesar cipher to encrypt the message “HELLO” with a shift of 3: 1. Write down the plaintext message: HELLO 2. Choose a shift value. In this case, we will use a shift of 3. 3. Replace each letter in the plaintext message with the letter that is three positions to the right in the alphabet.
  • 11.
    11 H becomes K(shift 3 from H) E becomes H (shift 3 from E) L becomes O (shift 3 from L) L becomes O (shift 3 from L) O becomes R (shift 3 from O) 4.The encrypted message is now “KHOOR”. • To decrypt the message, you simply need to shift each letter back by the same number of positions. In this case, you would shift each letter in “KHOOR” back by 3 positions to get the original message, “HELLO”. Examples : Text : ABCDEFGHIJKLMNOPQRSTUVWXYZ Shift: 23 Cipher: XYZABCDEFGHIJKLMNOPQRSTUVW Text : ATTACKATONCE Shift: 4 Cipher: EXXEGOEXSRGI
  • 12.
    12 Advantages: • Easy toimplement and use thus, making suitable for beginners to learn about encryption. • Can be physically implemented, such as with a set of rotating disks or a set of cards, known as a scytale, which can be useful in certain situations. • Requires only a small set of pre-shared information. • Can be modified easily to create a more secure variant, such as by using a multiple shift values or keywords. Disadvantages: • It is not secure against modern decryption methods. • Vulnerable to known-plaintext attacks, where an attacker has access to both the encrypted and unencrypted versions of the same messages. • The small number of possible keys means that an attacker can easily try all possible keys until the correct one is found, making it vulnerable to a brute force attack. • It is not suitable for long text encryption as it would be easy to crack. • It is not suitable for secure communication as it is easily broken. • Does not provide confidentiality, integrity, and authenticity in a message. Features of caesar cipher: 1. Substitution cipher: The Caesar cipher is a type of substitution cipher, where each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. 2. Fixed key: The Caesar cipher uses a fixed key, which is the number of positions by which the letters are shifted. This key is known to both the sender and the receiver. 3. Symmetric encryption: The Caesar cipher is a symmetric encryption technique, meaning that the same key is used for both encryption and decryption. 4. Limited keyspace: The Caesar cipher has a very limited keyspace of only 26 possible keys, as there are only 26 letters in the English alphabet. 5. Vulnerable to brute force attacks: The Caesar cipher is vulnerable to brute force attacks, as there are only 26 possible keys to try.
  • 13.
    13 Rules for theCaesar Cipher: 1. Choose a number between 1 and 25. This will be your “shift” value. 2. Write down the letters of the alphabet in order, from A to Z. 3. Shift each letter of the alphabet by the “shift” value. For example, if the shift value is 3, A would become D, B would become E, C would become F, and so on. 4. Encrypt your message by replacing each letter with the corresponding shifted letter. For example, if the shift value is 3, the word “hello” would become “khoor”. 5. To decrypt the message, simply reverse the process by shifting each letter back by the same amount. For example, if the shift value is 3, the encrypted message “khoor” would become “hello”. Algorithm for Caesar Cipher: Input: 1. Choose a shift value between 1 and 25. 2. Write down the alphabet in order from A to Z. 3. Create a new alphabet by shifting each letter of the original alphabet by the shift value. For example, if the shift value is 3, the new alphabet would be: 4. A B C D E F G H I J K L M N O P Q R S T U V W X Y Z D E F G H I J K L M N O P Q R S T U V W X Y Z A B C 5. Replace each letter of the message with the corresponding letter from the new alphabet. For example, if the shift value is 3, the word “hello” would become “khoor”. 6. To decrypt the message, shift each letter back by the same amount. For example, if the shift value is 3, the encrypted message “khoor” would become “hello”. Procedure: • Traverse the given text one character at a time . • For each character, transform the given character as per the rule, depending on whether we’re encrypting or decrypting the text. • Return the new string generated.
  • 14.
    14 Classification of Cipher/Classification of Encryption methods Modified Caesar Cipher Algorithm To encrypt a message proposed algorithm requires plaintext and encryption key. The encryption key is an integer value and it determines alphabet to be used for substitution. It is based on modulo twenty six arithmetic to ensure that integer value wraps round in case encryption key supplied is more than twenty six. Decryption follows reverse operations performed during the process of encryption. It requires decryption key, and encrypted text. The decryption key should be complement to the encryption key so that reverse character substitution can be achieved. As stated earlier, Caesar cipher simply shifts encrypted character by number of positions. In this paper author proposed a new method, where key size is fixed as one. In this method firstly alphabet index is checked if the alphabet index is even then increase the value by one else the index is odd decrease the key value by one. Furthermore, the characters of the encrypted text arescrambled in such a way that if an attempt is made to decrypt the cipher text it would not be easy to decrypt the text.
  • 15.
    15 Encryption Algorithm Step1: Takethe plain text as input. Step2: Firstly alphabet index is checked if the alphabet index is even then increase the value by one else decrease the key value by one. Step3: Get the encrypted text. Decryption Algorithm Step 1: Insert cipher text. Step2: Check alphabet index if the alphabet index is even then increase the value by one else decrease the key value by one. Step 3: Get the plain text.
  • 16.
    16 Encryption C=E (P) =(P+1) if P is even or zero than add one Else E (P) = (P-1) (mod 26) if p is odd than subtract one Decryption P=D(C) =(C-1) if C is odd than Subtract one Else D(C) = (C+1) if P is even or zero than add one A. Encryption Step 1: Suppose original message is Computer123 Step 2: Now apply Caesar cipher to encrypt the plain text. Shifting the key as one. Example 1 - Encryption process Plaintext : Computer123 Cipher Text: Dpnovsfq214 We get Dpnovsfq214 as cipher text because as per as algorithm the value C that is 2 is even (Refer to table 4) and we have to add one as per algorithm and we get D as cipher text of C. same way o is even and we add one and then p became cipher text of o. Decryption Process Cipher Text : Dpnovsfq214 Plaintext : Computer123 We get Computer123 as Plain Text because according to algorithm D is odd (Refer to table 4) and we have to Subtract one as per algorithm and we get
  • 17.
    17 C as PlainText of D. Same way p is odd and we subtract one and then o became plaintext of p. Encryption Decryption Transposition cipher A transposition cipher is a method of encryption in which the positions of the letters in the plaintext are rearranged to create the ciphertext. It does not involve any substitution of letters, only the rearrangement of their positions.
  • 18.
    18 For example, ifthe plaintext is “HELLO” and the key is 2, the letters might be rearranged like this “LEHOL”. Transposition techniques The various types of transposition cipher are: – 1. Rail fence technique 2. Simple columnar transposition technique (SCTT) 3. Vernam Cipher (One Time Pad) 4. Book cipher/ Running key cipher Simple columnar transposition techniques The simple columnar transposition technique can be categorized into two parts – Basic technique and multiple rounds. Simples columnar transposition technique – basic technique. The simple columnar transposition technique simply arranges the plain text in a sequence of rows of a rectangle and reads it in a columnar manner. How does this algorithm work? Step 1: Write all the characters of plain text message row by row in a rectangle of predefined size. Step 2: Read the message in a columnar manner, i.e. column by column. Note: For reading the message, it needs not to be in the order of columns. It can happen in any random sequence. Step 3: The resultant message is ciphertext. Example: Let’s assume that Plain text is a corporate bridge, and we need to calculate the cipher text using a simple columnar transposition technique.
  • 19.
    19 Let’s take 6columns and arrange the plain text in a row-wise manner. Decide the column order for reading the message – let’s assume 1,3,5,2,4,6 is an order. Now read the message in a columnar manner using the decided order. – cadreeorotgpbri cadreeorotgpbri is a ciphertext. Simple columnar transposition technique – Multiple rounds Simple columnar transposition technique with multiple rounds is the same as basic; only the difference is that we iterate the process multiple times in multiple rounds. Working of an algorithm Step 1: Write all the characters of plain text message row by row in a rectangle of predefined size. Step 2: Read the message in a columnar manner, i.e. column by column. Note: For reading the message, it needs not to be in the order of columns. It can happen in any random sequence. Step 3: The resultant message is ciphertext. Step 4: Repeat the procedure from step 1 to step 3 many times as desired.
  • 20.
    20 Example: Let’s assumethat Plain text is a corporate bridge, and we need to calculate the cipher text using a simple columnar transposition technique. Let’s take 6 columns and arrange the plain text in a row-wise manner. Decide the column order for reading the message – let’s assume 1,3,5,2,4,6 is an order. Now read the message in a columnar manner using the decided order. – cadreeorotgpbri cadreeorotgpbri is a ciphertext. Let’s perform step 1 to step 3 one more time. In the second iteration, the order of the columns will be the same. Ciphertext – cobdoiegarrrtep Continue the same procedure if more iteration is required.
  • 21.
    21 What is Steganography? Steganographyis the practice of hiding a secret message inside of (or even on top of) something that is not secret. That something can be just about anything you want. Steganography attempts to hide a message within another object. Not only does steganography seek to make this information harder to understand, but it also seeks to conceal that a message is being sent in the first place. Examples of Steganography Steganography has been in use for centuries. Basic physical forms of steganography include invisible ink that can only be read by exposing it to heat and messages written under the postage stamps of an envelope. What Are the 5 Types of Steganography? 1. Text steganography Text steganography conceals a secret message inside a piece of text. The simplest version of text steganography might use the first letter in each sentence to form the hidden message. Other text steganography techniques might include adding meaningful typos or encoding information through punctuation. 2. Image steganography In image steganography, secret information is encoded within a digital image. This technique relies on the fact that small changes in image color or noise are very difficult to detect with the human eye. For example, one image can be concealed within another by using the least significant bits of each pixel in the image to represent the hidden image instead.
  • 22.
    22 3. Video steganography Videosteganography is a more sophisticated version of image steganography that can encode entire videos. Because digital videos are represented as a sequence of consecutive images, each video frame can encode a separate image, hiding a coherent video in plain sight. 4. Audio steganography Audio files, like images and videos, can be used to conceal information. One simple form of audio steganography is “backmasking,” in which secret messages are played backwards on a track (requiring the listener to play the entire track backwards). More sophisticated techniques might involve the least significant bits of each byte in the audio file, similar to image steganography. 5. Network steganography Last but not least, network steganography is a clever digital steganography technique that hides information inside network traffic. For example, data can be concealed within the TCP/IP headers or payloads of network packets. The sender can even impart information based on the time between sending different packets. How steganography works Steganography works by concealing information in a way that avoids suspicion. One of the most prevalent techniques is called ‘least significant bit’ (LSB) steganography. This involves embedding the secret information in the least significant bits of a media file. For example: In an image file, each pixel is made up of three bytes of data corresponding to the colors red, green, and blue. Some image formats allocate an additional fourth byte to transparency, or ‘alpha’.
  • 23.
    23 LSB steganography altersthe last bit of each of those bytes to hide one bit of data. So, to hide one megabyte of data using this method, you would need an eight-megabyte image file. Modifying the last bit of the pixel value doesn’t result in a visually perceptible change to the picture, which means that anyone viewing the original and the steganographically-modified images won’t be able to tell the difference. Symmetric cryptography With symmetric cryptography (or symmetric-key encryption), the same key is used for both encryption and decryption as shown in Figure 1.
  • 24.
    24 Figure 1. Symmetrickey encryption Symmetric key ciphers are valuable because: • It is relatively inexpensive to produce a strong key for these ciphers. • The keys tend to be much smaller for the level of protection they afford. • The algorithms are relatively inexpensive to process. What is Symmetric Cryptography? Definition: A cryptographic key that is used to perform both the cryptographic operation and its inverse, such as encrypting and decrypting or creating and verifying a message authentication code. This means that the same key is required in order to perform both functions. Symmetric Cryptography explained Symmetric cryptography is a single cryptographic key that is used with a symmetric-key cryptographic algorithm and is uniquely associated with one or more entities and is not made public (i.e., the key is kept secret). A symmetric key is often called a secret key. The use of the term “secret” in this context does not imply a level of secrecy, but rather implies the need to protect the key from disclosure. Symmetric encryption is often used for bulk encryption of large amounts of data. It is also largely used to secure data at rest. Some examples are: • Banking - Payment transactions, such as card payment information • Data storage- encrypting data stored on a device when that data is not being transferred • Validating the message of the sender • Random number generation
  • 25.
    25 Implementing symmetric cryptography(particularly with hardware) can be highly effective because you do not experience any significant time delay as a result of the encryption and decryption. One of the primary challenges of symmetric encryption, known as the "key distribution problem," is distributing the key in a secure manner. The key is essential in symmetric cryptography, and we cannot afford to lose or misplace it. Malicious actors can decrypt the message if the individual keys are lost or misplaced. This is why, for data in motion, asymmetric cryptography should be used. What is Asymmetric Cryptography? Definition: Asymmetric cryptography is a cryptographic system in which each user has a private key that is kept secret and is used to generate a public key (which is freely provided to others). Users can use their private key to digitally sign data, and the resulting signature can be verified by anyone who has the corresponding public key. Asymmetric Cryptography explained Asymmetric encryption uses one key - the public key, to encrypt, and a different but mathematically related key - the private key, to decrypt. These keys work as a matched set (or a ‘key pair’). If the only thing known is the public key, determining the private key is computationally impossible. As a result, the public key can be distributed widely while the private key remains private and secure. This interdependence provides a variety of benefits, the most important of which are most likely digital signatures.
  • 26.
    26 Digital signatures areused to ensure that a message was created by a specific entity and to authenticate remote systems or users, among other things. Private keys are not shared and can be stored in the software or operating system that is used, or on hardware such as a hardware security module (HSM) that provides higher levels of data security and trust. Asymmetric cryptography is also referred to as public key cryptography. How does asymmetric cryptography work? Asymmetric encryption uses a mathematically related pair of keys for encryption and decryption: a public key and a private key. If the public key is used for encryption, then the related private key is used for decryption. If the private key is used for encryption, then the related public key is used for decryption. The two participants in the asymmetric encryption workflow are the sender and the receiver. Each has its own pair of public and private keys. First, the sender obtains the receiver's public key. Next, the plaintext message is encrypted by the sender using the receiver's public key. This creates ciphertext. The ciphertext is sent to the receiver, who decrypts it with their private key, returning it to legible plaintext. Because of the one-way nature of the encryption function, one sender is unable to read the messages of another sender, even though each has the public key of the receiver.
  • 27.
    27 Uses of asymmetriccryptography Asymmetric cryptography is typically used to authenticate data using digital signatures. A digital signature is a mathematical technique used to validate the authenticity and integrity of a message, software or digital document. It is the digital equivalent of a handwritten signature or stamped seal. Based on asymmetric cryptography, digital signatures can provide assurances of evidence to the origin, identity and status of an electronic document, transaction or message, as well as acknowledge informed consent by the signer. Asymmetric cryptography can also be applied to systems in which many users may need to encrypt and decrypt messages, including: Encrypted email. A public key can be used to encrypt a message and a private key can be used to decrypt it. SSL/TLS. Establishing encrypted links between websites and browsers also makes use of asymmetric encryption. Cryptocurrencies. Bitcoin and other cryptocurrencies rely on asymmetric cryptography. Users have public keys that everyone can see and private keys that are kept secret. Bitcoin uses a cryptographic algorithm to ensure only legitimate owners can spend the funds.
  • 28.
    28 Symmetric Key Encryption: Encryptionis a process to change the form of any message in order to protect it from reading by anyone. In Symmetric-key encryption the message is encrypted by using a key and the same key is used to decrypt the message which makes it easy to use but less secure. It also requires a safe method to transfer the key from one party to another. WHAT IS SYMMETRIC ENCRYPTION? Symmetric encryption is a type of encryption key management solution where only one key (a secret key) is used to both encrypt and decrypt electronic data. The entities communicating via symmetric encryption must exchange the key so that it can be used in the decryption process. This encryption method differs from asymmetric encryption where a pair of keys - one public and one private - is used to encrypt and decrypt messages.
  • 29.
    29 here are twotypes of symmetric encryption algorithms: Block algorithms. Set lengths of bits are encrypted in blocks of electronic data with the use of a specific secret key. As the data is being encrypted, the system holds the data in its memory as it waits for complete blocks. Stream algorithms. Data is encrypted as it streams instead of being retained in the system’s memory. Some examples of symmetric encryption algorithms include: AES (Advanced Encryption Standard) DES (Data Encryption Standard) IDEA (International Data Encryption Algorithm) Blowfish (Drop-in replacement for DES or IDEA) RC4 (Rivest Cipher 4) RC5 (Rivest Cipher 5) RC6 (Rivest Cipher 6)
  • 30.
    30 Asymmetric Key Encryption: AsymmetricKey Encryption is based on public and private key encryption techniques. It uses two different key to encrypt and decrypt the message. It is more secure than the symmetric key encryption technique but is much slower. What is Asymmetric Encryption? Asymmetric encryption, also known as public-key cryptography, is a type of encryption that uses a pair of keys to encrypt and decrypt data. The pair of keys includes a public key, which can be shared with anyone, and a private key, which is kept secret by the owner. In asymmetric encryption, the sender uses the recipient’s public key to encrypt the data. The recipient then uses their private key to decrypt the data. This approach allows for secure communication between two parties without the need for both parties to have the same secret key.
  • 31.
    31 Advantages of AsymmetricEncryption Asymmetric encryption also known as public key cryptography is a method of cryptography that uses two different keys to encrypt and decrypt data, here are some advantages of asymmetric encryption: – Enhanced Security: Asymmetric encryption provides a higher level of security compared to symmetric encryption where only one key is used for both encryption and decryption with asymmetric encryption a different key is used for each process and the private key used for decryption is kept secret by the receiver making, it harder for an attacker to intercept and decrypt the data. Authentication: Asymmetric encryption can be used for authentication purposes which means that the receiver can verify the sender s identity. This is achieved by the sender encrypting a message with their private key which can only be decrypted with their public key if the receiver can successfully decrypt the message, it proves that it was sent by the sender who has the corresponding private key. Non-repudiation: Asymmetric encryption also provides non-repudiation which means that the sender cannot deny sending a message or altering its
  • 32.
    32 contents this isbecause the message is encrypted with the sender s private key and only their public key can decrypt it . Therefore, the receiver can be sure that the message was sent by the sender and has not been tampered with. Key distribution: Asymmetric encryption eliminates the need for a secure key distribution system that is required in symmetric encryption with symmetric encryption, the same key is used for both encryption and decryption and the key needs to be securely shared between the sender and the receiver asymmetric encryption, on the other hand, allows the public key to be shared openly and the private key is kept secret by the receiver. Versatility: Asymmetric encryption can be used for a wide range of applications including secure email communication online banking transactions and e-commerce it is also used to secure SSL/TSL connections which are commonly used to secure internet traffic. The main features of asymmetric encryption (also known as public-key cryptography) are: Dual keys: Asymmetric encryption uses a pair of keys, including a public key and a private key. The public key can be freely shared with anyone, while the private key is kept secret and known only to the key owner. Encryption and decryption: Asymmetric encryption uses the public key to encrypt data and the private key to decrypt data. This allows secure communication between two parties without the need to exchange secret keys. Digital signatures: Asymmetric encryption enables the creation of digital signatures, which can be used to verify the authenticity of data. A digital signature is created by encrypting a hash of the data with the sender’s private key.
  • 33.
    33 Secure key exchange:Asymmetric encryption allows for secure key exchange, which is a critical feature in secure communication. For example, the Diffie-Hellman key exchange algorithm uses asymmetric encryption to establish a shared secret key between two parties without exchanging the key itself. Security: Asymmetric encryption is considered more secure than symmetric encryption because it eliminates the need to exchange secret keys, which can be a security risk. Additionally, the private key is kept secret, which makes it harder for attackers to intercept or tamper with the data. Slow processing: Asymmetric encryption is slower than symmetric encryption because it involves more complex mathematical operations. This can make it less suitable for applications that require fast data processing. Symmetric Key Encryption Asymmetric Key Encryption It only requires a single key for both encryption and decryption. It requires two keys, a public key and a private key, one to encrypt and the other one to decrypt. The size of cipher text is the same or smaller than the original plain text. The size of cipher text is the same or larger than the original plain text. The encryption process is very fast. The encryption process is slow. It is used when a large amount of data is required to transfer. It is used to transfer small amounts of data. It only provides confidentiality. It provides confidentiality,
  • 34.
    34 Symmetric Key EncryptionAsymmetric Key Encryption authenticity, and non-repudiation. The length of key used is 128 or 256 bits The length of key used is 2048 or higher In symmetric key encryption, resource utilization is low as compared to asymmetric key encryption. In asymmetric key encryption, resource utilization is high. It is efficient as it is used for handling large amount of data. It is comparatively less efficient as it can handle a small amount of data. The Mathematical Representation is as follows- P = D (K, E(K, P)) where K –> encryption and decryption key P –> plain text D –> Decryption E(K, P) –> Encryption of plain text using K The Mathematical Representation is as follows- P = D(Kd, E (Ke,P)) where Ke –> encryption key Kd –> decryption key D –> Decryption E(Ke, P) –> Encryption of plain text using encryption key Ke. P –> plain text Examples: 3DES, AES, DES and RC4 Examples: Diffie-Hellman, ECC, El Gamal, DSA and RSA
  • 35.
    35 Data encryption standard(DES) What is DES? The Data Encryption Standard (DES) is a symmetric-key block cipher published by the National Institute of Standards and Technology (NIST). DES is an implementation of a Feistel Cipher. It uses 16 round Feistel structure. The block size is 64-bit. Though, key length is 64-bit, DES has an effective key length of 56 bits, since 8 of the 64 bits of the key are not used by the encryption algorithm (function as check bits only). General Structure of DES is depicted in the following illustration – Since DES is based on the Feistel Cipher, all that is required to specify DES is −
  • 36.
    36 • Round function •Key schedule • Any additional processing − Initial and final permutation Initial and Final Permutation The initial and final permutations are straight Permutation boxes (P-boxes) that are inverses of each other. They have no cryptography significance in DES. The initial and final permutations are shown as follows – Round Function The heart of this cipher is the DES function, f. The DES function applies a 48-bit key to the rightmost 32 bits to produce a 32-bit output.
  • 37.
    37 Expansion Permutation Box− Since right input is 32-bit and round key is a 48-bit, we first need to expand right input to 48 bits. Permutation logic is graphically depicted in the following illustration – XOR (Whitener). − After the expansion permutation, DES does XOR operation on the expanded right section and the round key. The round key is used only in this operation. Substitution Boxes. − The S-boxes carry out the real mixing (confusion). DES uses 8 S-boxes, each with a 6-bit input and a 4-bit output. Refer the following illustration –
  • 38.
    38 Straight Permutation −The 32 bit output of S-boxes is then subjected to the straight permutation with rule Key Generation The round-key generator creates sixteen 48-bit keys out of a 56-bit cipher key. The process of key generation is depicted in the following illustration –
  • 39.
    39 The logic forParity drop, shifting, and Compression P-box is given in the DES description. DES Analysis The DES satisfies both the desired properties of block cipher. These two properties make cipher very strong. Avalanche effect − A small change in plaintext results in the very great change in the ciphertext. Completeness − Each bit of ciphertext depends on many bits of plaintext.