Unit 2: Cryptography
Cryptography
Cryptography is a technique of securing information and communications through
the use of codes so that only those persons for whom the information is intended
can understand and process it. Thus, preventing unauthorized access to
information. The prefix “crypt” means “hidden” and the suffix “graphy” means
“writing”. In Cryptography, the techniques that are used to protect information are
obtained from mathematical concepts and a set of rule-based calculations known
as algorithms to convert messages in ways that make it hard to decode them.
These algorithms are used for cryptographic key generation, digital signing, and
verification to protect data privacy, web browsing on the internet and to protect
confidential transactions such as credit card and debit card transactions
Features Of Cryptography
● Confidentiality: Information can only be accessed by the person for whom it is
intended and no other person except him can access it.
● Integrity: Information cannot be modified in storage or transition between sender and
intended receiver without any addition to information being detected.
● Non-repudiation: The creator/sender of information cannot deny his intention to send
information at a later stage.
● Authentication: The identities of the sender and receiver are confirmed. As well
destination/origin of the information is confirmed.
● Interoperability: Cryptography allows for secure communication between different
systems and platforms.
● Adaptability: Cryptography continuously evolves to stay ahead of security threats and
technological advancements.
Types Of Cryptography
1. Symmetric Key Cryptography
It is an encryption system where the sender and receiver of a message use a single common key to
encrypt and decrypt messages. Symmetric Key cryptography is faster and simpler but the problem is that
the sender and receiver have to somehow exchange keys securely. The most popular symmetric key
cryptography systems are Data Encryption Systems (DES) and Advanced Encryption Systems (AES) .
2. Hash Functions
There is no usage of any key in this algorithm. A hash value with a fixed length is calculated as per the
plain text which makes it impossible for the contents of plain text to be recovered. Many operating
systems use hash functions to encrypt passwords.
3. Asymmetric Key Cryptography
In Asymmetric Key Cryptography, a pair of keys is used to encrypt and decrypt information. A
sender’s public key is used for encryption and a receiver’s private key is used for decryption. Public
keys and Private keys are different. Even if the public key is known by everyone the intended
receiver can only decode it because he alone knows his private key. The most popular asymmetric
key cryptography algorithm is the RSA algorithm.
Applications of Cryptography :
Computer passwords
Digital Currencies
Secure web browsing
Electronic Signatures
Authentication
Cryptocurrencies
End-to-end Internet Encryption
What is Plaintext?
Plaintext is an encryption technique, that converts an encrypted message. It refers
to any readable data, including binary files, that can be seen or used without the
requirement for a decryption key or device. Plain text is often used for several
tasks, such as document creation, coding, and email communication. Plaintext
implies any communication, document, or file that is meant to be or has already
been encrypted. A cryptosystem accepts plaintext as input and produces
ciphertext as output.
Plaintext In cryptography plain readable text, is either before it is encrypted into
ciphertext or after it is decoded. Plaintext refers to any communication, document,
file, or other type of data that is not encrypted. Plaintext kept in a computer file
must be protected since its contents are fully accessible and hence potentially
actionable if stolen, leaked, or distributed without authorization. If data is to be
saved, the storage media, device, components, and backups must all be secure. If
plaintext is saved in a computer file, the storage media, the system, and its
components, and any backups must all be secure. When sensitive data is handled
on computers with removable mass storage, the physical security of the removed
disk is crucial.
Applications of Plaintext
● Plaintext is used in command-line interfaces, which are text-based interfaces that allow you to
communicate with computers. Humans can easily read and input commands using simple
text.
● Plaintext in cryptography is used to write papers such as articles, reports, and essays since it
is simple to read and understand and without any formatting or multimedia components that
may be distracting.
● Plaintext is one of the formats used in email communication to transmit and receive
messages. The messages are not structured and do not contain multimedia components.
Examples of Plaintext
● Plaintext is preferred in the majority of applications. For example, Plaintext should appear in a
browser, word processor, or email client.
● Password protection for PowerShell scripts To prevent disclosing such credentials in their
scripts, developers must exercise caution.
● Plaintext stored in computer files must be protected since unlawful theft, disclosure, or
transfer exposes its contents, making them potentially actionable.
Plaintext Attack
The plaintext attack (KPA) is a cryptanalysis attack paradigm in which the attacker possesses both
the plaintext (also known as a crib) and its encrypted version (ciphertext). These can be used to
reveal more secrets, such as hidden keys and codebooks.
Traditional ciphers are frequently attacked using known plaintext. A Caesar cipher, for example, can
be decoded fully using a single letter from both plaintext and ciphertext.
Benefits of Plaintext
Below are some benefits of plaintext
● Plaintext offers a lot of advantages over rich text, including its simplicity, universality, and
compatibility with any platform, device, or program.
● It is also lightweight, making it simple to store, back up, and transport.
● Plaintext is also searchable, readable, and editable by people and machines.
● Plaintext in cryptography is easy to open on different platforms.
Encryption
Encryption in cryptography is a process by which plain text or a piece of information is
converted into cipher text or text that can only be decoded by the receiver for whom the
information was intended. The algorithm used for the encryption process is known as cipher. It
helps to protect consumer information, emails, and other sensitive data from unauthorized
access as well as secures communication networks. Presently there are many options to
choose from and find the most secure algorithm that meets our requirements.
What is Symmetric Encryption?
When the plaintext is encrypted and decrypted using the same key, it is know as symmetric
encryption. It is also known as "shared-key" or "private-key" encrytption.
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 cryptography, a key is a string of bits used by a cryptographic algorithm to transform plaintext
into ciphertext (encryption) or ciphertext back into plaintext (decryption). The key ensures the
confidentiality, integrity, and authenticity of the data.
Keys are typically categorized into two types:
1. Symmetric Key:
A single key is used for both encryption and decryption. Both the sender and receiver must
possess the same secret key and keep it confidential. Symmetric key algorithms are
generally faster and are suitable for encrypting large amounts of data.
Example algorithms: AES, DES.
2. Asymmetric Key (Public-Key Cryptography):
Two mathematically related keys are used—a public key for encryption and a private key for
decryption. The public key may be shared openly, while the private key is kept secure.
Asymmetric cryptography is commonly used for secure key exchange and digital signatures.
Example algorithms: RSA, ECC.
Ciphertext
Ciphertext is the encrypted form of a message produced by applying a cryptographic algorithm (cipher)
to plaintext using a key. It appears as a seemingly random or unreadable string of characters and cannot
be understood without proper decryption.
In formal terms:
If E is the encryption function and K is the encryption key, then
Ciphertext (C) = E(K, Plaintext)
The purpose of ciphertext is to protect the confidentiality of the original information during transmission
or storage, ensuring that only authorized parties can access the underlying data through decryption.
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
Decryption
Decryption is the process of converting ciphertext back into plaintext using a cryptographic key
and a decryption algorithm. It is the reverse of encryption and is performed by an authorized
party who possesses the correct key.
Formally, if D is the decryption function and K is the decryption key, then:
Plaintext (P) = D(K, Ciphertext)
In symmetric cryptography, the same key is used for both encryption and decryption.
In asymmetric cryptography, a different (private) key is used for decryption than the one used
for encryption (public).
Cryptanalysis
Cryptanalysis is the study and practice of analyzing cryptographic systems to discover weaknesses or
to break encryption without knowing the secret key. The goal of cryptanalysis is to retrieve plaintext or
keys by exploiting flaws in the encryption algorithm, implementation, or through side-channel information.
Types of cryptanalysis include:
● Brute-force attacks – trying all possible keys
● Statistical attacks – analyzing patterns in ciphertext
● Known-plaintext attacks – attacker has samples of both plaintext and corresponding ciphertext
● Chosen-plaintext attacks – attacker can encrypt plaintexts of their choice
● Side-channel attacks – exploiting physical leakage (like timing or power consumption)
Public Key Encryption
Public key cryptography is a method of secure communication that uses a pair of keys, a
public key, which anyone can use to encrypt messages or verify signatures, and a private
key, which is kept secret and used to decrypt messages or sign documents. This system
ensures that only the intended recipient can read an encrypted message and that a signed
message truly comes from the claimed sender. Public key cryptography is essential for
secure internet communications, allowing for confidential messaging, authentication of
identities, and verification of data integrity.
What is a Cryptographic Key?
A cryptographic key is a piece of information used by cryptographic algorithms to encrypt or decrypt data,
authenticate identities, or generate digital signatures. It serves as a parameter to control cryptographic operations,
ensuring the security and privacy of digital communications and transactions.
Encryption
The process of changing the plaintext into the ciphertext is referred to as encryption.
The encryption process consists of an algorithm and a key. The key is a value independent of the
plaintext.
Decryption
The process of changing the ciphertext to the plaintext that process is known as decryption.