You are on page 1of 10

Computer Network Security Chapter 3: Cryptography and Public key Infrastructure

Chapter 3: Cryptography and Public Key Infrastructure

1. INTRODUCTION OF CRYPTOGRAPHY
An original message is known as the plaintext, while the coded message is called the ciphertext. The process
of converting from plaintext to ciphertext is known as enciphering or encryption; restoring the plaintext
from the ciphertext is deciphering or decryption. The many schemes used for encryption constitute the
area of study known as cryptography. Such a scheme is known as a cryptographic system or a cipher.
Techniques used for deciphering a message without any knowledge of the enciphering details fall into the
area of cryptanalysis. Cryptanalysis is what the layperson calls “breaking the code.” The areas of
cryptography and cryptanalysis together are called cryptology.
There are five primary functions of cryptography today:
1. Privacy/confidentiality: Ensuring that no one can read the message except the intended receiver.
2. Authentication: The process of proving one's identity.
3. Integrity: Assuring the receiver that the received message has not been altered in any way from the
original.
4. Non-repudiation: A mechanism to prove that the sender really sent this message.
5. Key exchange: The method by which crypto keys are shared between sender and receiver.
In cryptography, we start with the unencrypted data, referred to as plaintext. Plaintext is encrypted
into ciphertext, which will in turn (usually) be decrypted into usable plaintext. The encryption and
decryption is based upon the type of cryptography scheme being employed and some form of key. For those
who like formulas, this process is sometimes written as:
C = Ek(P)
P = Dk(C)
where P = plaintext, C = ciphertext, E = the encryption method, D = the decryption method, and k = the
key.

2. TYPES OF CRYPTOGRAPHIC ALGORITHMS


Cryptographic algorithms can be categorized based on the number of keys that are employed for encryption
and decryption. These are:
 Secret Key Cryptography (SKC): Uses a single key for both encryption and decryption; also
called symmetric encryption. Primarily used for privacy and confidentiality.
 Public Key Cryptography (PKC): Uses one key for encryption and another for decryption; also
called asymmetric encryption. Primarily used for authentication, non-repudiation, and key
exchange.
Page 1 of 10
Computer Network Security Chapter 3: Cryptography and Public key Infrastructure

 Hash Functions: Uses a mathematical transformation to irreversibly "encrypt" information,


providing a digital fingerprint. Primarily used for message integrity.

Figure 1: Three types of cryptography: secret key, public key, and hash function.

3. SECRET KEY CRYPTOGRAPHY (SYMMETRIC ENCRYPTION)


Secret key cryptography methods employ a single key for both encryption and decryption. The sender uses
the key to encrypt the plaintext and sends the ciphertext to the receiver. The receiver applies the same key
to decrypt the message and recover the plaintext. Because a single key is used for both functions, secret
key cryptography is also called symmetric encryption.
A symmetric encryption scheme has five ingredients as shown in figure 2:
 Plaintext: This is the original intelligible message or data that is fed into the algorithm as input.
 Encryption algorithm: The encryption algorithm performs various substitutions and transformations
on the plaintext.
 Secret key: The secret key is also input to the encryption algorithm. The key is a value independent
of the plaintext and of the algorithm. The algorithm will produce a different output depending on
the specific key being used at the time. The exact substitutions and transformations performed by
the algorithm depend on the key.
 Ciphertext: This is the scrambled message produced as output. It depends on the plaintext and the
secret key. For a given message, two different keys will produce two different ciphertexts. The
ciphertext is an apparently random stream of data and, as it stands, is unintelligible.
 Decryption algorithm: This is essentially the encryption algorithm run in reverse. It takes the
ciphertext and the secret key and produces the original plaintext.
Page 2 of 10
Computer Network Security Chapter 3: Cryptography and Public key Infrastructure

Figure 2: Simplified Model of Symmetric Encryption

A substitution technique is one in which the letters of plaintext are replaced by other letters or by numbers
or symbols. If the plaintext is viewed as a sequence of bits, then substitution involves replacing plaintext bit
patterns with ciphertext bit patterns. Different types of encryption techniques are listed and described
below.
A. Caesar’s Cipher
B. Playfair Cipher
C. Keyword Cipher
D. Vigenere (Polyalphabetic) Cipher,
E. One Time Pad (Vermin Cipher)

A. Caesar’s Cipher
The Caesar cipher involves replacing each letter of the alphabet with the letter standing three places further
down the alphabet. For example,
plain: meet me after the toga party
cipher: PHHW PH DIWHU WKH WRJD SDUWB

The alphabet is wrapped around, so that the letter following Z is A. We can define the transformation by
listing all possibilities, as follows:

Let us assign a numerical equivalent to each letter:

Page 3 of 10
Computer Network Security Chapter 3: Cryptography and Public key Infrastructure

Then the algorithm can be expressed as follows.


To do the encryption, for each plaintext letter p, substitute the ciphertext letter C:
C = E(3, p) = (p + 3) mod 26
Example: for plaintext letter M number is 12
C=(12+3) mod 26 = 15 so, for number 15 alphabet is “P”

To do the decryption, for each plaintext letter C, substitute the ciphertext letter p:
p = D(3, C) = (C - 3) mod 26

Example: for cipher text “P” number is 15


P=(15-3) mod 26= 12 so, for number 12 alphabet is “M”.

A shift may be of any amount, so that the general Caesar algorithm is


C = E(k, p) = (p + k) mod 26
Where k takes on a value in the range 1 to 25.The decryption algorithm is simply
p = D(k, C) = (C - k) mod 26
If we use any value k then it is known as shift cipher.

4. PUBLIC KEY CRYPTOGRAPHY (ASYMMETRIC ENCRYPTION)


This method employs two keys that are mathematically related although knowledge of one key does not
allow someone to easily determine the other key. One key is used to encrypt the plaintext and the other
key is used to decrypt the ciphertext. The important point here is that it does not matter which key is applied
first, but that both keys are required for the process to work. Because a pair of keys are required, this
approach is also called asymmetric cryptography.
In this, one of the keys is designated the public key and may be advertised as widely as the owner wants.
The other key is designated the private key and is never revealed to another party. It is straight forward to
send messages under this scheme. Suppose Alice wants to send Bob a message. Alice encrypts some
information using Bob's public key; Bob decrypts the ciphertext using his private key.

Page 4 of 10
Computer Network Security Chapter 3: Cryptography and Public key Infrastructure

Digital Signature and Verification


Digital signature is a mechanism by which a message is authenticated i.e. proving that a message is
effectively coming from a given sender, much like a signature on a paper document. A digital signature is a
technique that binds a person/entity to the digital data. This binding can be independently verified by
receiver as well as any third party. Digital signature is a cryptographic value that is calculated from the data
and a secret key known only by the signer.
For instance, suppose that Alice wants to digitally sign a message to Bob. To do so, she uses her private-key
to encrypt the message; she then sends the message along with her public-key (typically, the public key is
attached to the signed message). Since Alice’s public-key is the only key that can decrypt that message, a
successful decryption constitutes a Digital Signature Verification, meaning that there is no doubt that it is
Alice’s private key that encrypted the message.

Figure 3: Digital Signature/Verification principles

Model of Digital Signature


The digital signature scheme is based on public key cryptography. The model of digital signature scheme is
depicted in the following illustration –

Figure 4: Digital Signature Model

The following points explain the entire process in detail −

Page 5 of 10
Computer Network Security Chapter 3: Cryptography and Public key Infrastructure

 Each person adopting this scheme has a public-private key pair.


 Generally, the key pairs used for encryption/decryption and signing/verifying are different. The
private key used for signing is referred to as the signature key and the public key as the verification
key.
 Signer feeds data to the hash function and generates hash of data.
 Hash value and signature key are then fed to the signature algorithm which produces the digital
signature on given hash. Signature is appended to the data and then both are sent to the verifier.
 Verifier feeds the digital signature and the verification key into the verification algorithm. The
verification algorithm gives some value as output.
 Verifier also runs same hash function on received data to generate hash value.
 For verification, this hash value and output of verification algorithm are compared. Based on the
comparison result, verifier decides whether the digital signature is valid.
 Since digital signature is created by ‘private’ key of signer and no one else can have this key; the
signer cannot disclaim signing the data in future.

Importance of Digital Signature


Out of all cryptographic primitives, the digital signature using public key cryptography is considered as very
important and useful tool to achieve information security.
Apart from ability to provide non-repudiation (identifying the sender authentication) of message, the digital
signature also provides message authentication and data integrity. Let us briefly see how this is achieved
by the digital signature −
 Message authentication − When the verifier validates the digital signature using public key of a
sender, he is assured that signature has been created only by sender who possess the
corresponding secret private key and no one else.
 Data Integrity − In case an attacker has access to the data and modifies it, the digital signature
verification at receiver end fails. The hash of modified data and the output provided by the
verification algorithm will not match. Hence, receiver can safely deny the message assuming that
data integrity has been breached.
 Non-repudiation − Since it is assumed that only the signer has the knowledge of the signature key,
he can only create unique signature on a given data. Thus the receiver can present data and the
digital signature to a third party as evidence if any dispute arises in the future.
By adding public-key encryption to digital signature scheme, we can create a cryptosystem that can provide
the four essential elements of security namely − Privacy, Authentication, Integrity, and Non-repudiation.

Encryption with Digital Signature

Page 6 of 10
Computer Network Security Chapter 3: Cryptography and Public key Infrastructure

In many digital communications, it is desirable to exchange an encrypted messages than plaintext to


achieve confidentiality. In public key encryption scheme, a public (encryption) key of sender is available in
open domain, and hence anyone can spoof his identity and send any encrypted message to the receiver.
This makes it essential for users employing public key cryptography for encryption to seek digital signatures
along with encrypted data to be assured of message authentication and non-repudiation.
This can archived by combining digital signatures with encryption scheme. Let us briefly discuss how to
achieve this requirement. There are two possibilities, sign-then-encrypt and encrypt-then-sign.
However, the crypto system based on sign-then-encrypt can be exploited by receiver to spoof identity of
sender and sent that data to third party. Hence, this method is not preferred. The process of encrypt-then-
sign is more reliable and widely adopted. This is depicted in the following illustration –

Figure 5: encrypt-then-sign based digital signature

The receiver after receiving the encrypted data and signature on it, first verifies the signature using sender’s
public key. After ensuring the validity of the signature, he then retrieves the data through decryption using
his private key.

5. PUBLIC KEY INFRASTRUCTURE


The most distinct feature of Public Key Infrastructure is that it uses a pair of keys to achieve the underlying
security service. The key pair comprises of private key and public key.
Since the public keys are in open domain, they are likely to be abused. It is, thus, necessary to establish
and maintain some kind of trusted infrastructure to manage these keys.

Page 7 of 10
Computer Network Security Chapter 3: Cryptography and Public key Infrastructure

Key Management
There are some important aspects of key management which are as
follows −
 Cryptographic keys are nothing but special pieces of data. Key
management refers to the secure administration of
cryptographic keys.
 Key management deals with entire key lifecycle as depicted in
the following illustration −

 There are two specific requirements of key management for public key cryptography.
o Secrecy of private keys. Throughout the key lifecycle, secret keys must remain secret from
all parties except those who are owner and are authorized to use them.
o Assurance of public keys. In public key cryptography, the public keys are in open domain and
seen as public pieces of data. By default there are no assurances of whether a public key is
correct, with whom it can be associated, or what it can be used for. Thus key management
of public keys needs to focus much more explicitly on assurance of purpose of public keys.

The most crucial requirement of ‘assurance of public key’ can be achieved through the public-key
infrastructure (PKI), a key management systems for supporting public-key cryptography.

5.1 Public Key Infrastructure (PKI)


PKI provides assurance of public key. It provides the identification of public keys and their distribution. An
anatomy of PKI comprises of the following components.
 Public Key Certificate, commonly referred to as ‘digital certificate’.
 Private Key tokens.
 Certification Authority.
 Registration Authority.
 Certificate Management System.

Figure 6: key lifecycle

Page 8 of 10
Computer Network Security Chapter 3: Cryptography and Public key Infrastructure

5.1.1 Digital Certificate


For analogy, a certificate can be
considered as the ID card issued to the
person. People use ID cards such as a
driver's license, passport to prove their
identity. A digital certificate does the
same basic thing in the electronic
world, but with one difference.
Digital Certificates are not only issued
to people but they can be issued to
computers, software packages or
anything else that need to prove the
identity in the electronic world.
The process of obtaining Digital
Certificate by a person/entity is
depicted in the following illustration.

As shown in the illustration, the Certifying Authority (CA) accepts the application from a client to certify his
public key. The CA, after duly verifying identity of client, issues a digital certificate to that client.

5.1.2 Certifying Authority (CA)


The CA issues certificate to a client and assist other users to verify the certificate. The CA takes responsibility
for identifying correctly the identity of the client asking for a certificate to be issued, and ensures that the
information contained within the certificate is correct and digitally signs it.
The key functions of a CA are as follows −
 Generating key pairs − The CA may generate a key pair independently or jointly with the client.
 Issuing digital certificates − The CA could be thought of as the PKI equivalent of a passport agency −
the CA issues a certificate after client provides the credentials to confirm his identity. The CA then
signs the certificate to prevent modification of the details contained in the certificate.
 Publishing Certificates − The CA need to publish certificates so that users can find them. There are
two ways of achieving this. One is to publish certificates in the equivalent of an electronic telephone
directory. The other is to send your certificate out to those people you think might need it by one
means or another.
 Verifying Certificates − The CA
Figure 7: process of obtaining Digital Certificate by a person/entity
makes its public key available in
environment to assist verification of his signature on clients’ digital certificate.
Page 9 of 10
Computer Network Security Chapter 3: Cryptography and Public key Infrastructure

 Revocation of Certificates − At times, CA revokes the certificate issued due to some reason such as
compromise of private key by user or loss of trust in the client. After revocation, CA maintains the
list of all revoked certificate that is available to the environment.
There are four typical classes of certificate −
 Class 1 − These certificates can be easily acquired by supplying an email address.
 Class 2 − These certificates require additional personal information to be supplied.
 Class 3 − These certificates can only be purchased after checks have been made about the
requestor’s identity.
 Class 4 − They may be used by governments and financial organizations needing very high levels of
trust.

5.1.3 Registration Authority (RA)


CA may use a third-party Registration Authority (RA) to perform the necessary checks on the person or
company requesting the certificate to confirm their identity. The RA may appear to the client as a CA, but
they do not actually sign the certificate that is issued.

5.1.4 Certificate Management System (CMS)


It is the management system through which certificates are published, temporarily or permanently
suspended, renewed, or revoked. Certificate management systems do not normally delete certificates
because it may be necessary to prove their status at a point in time, perhaps for legal reasons. A CA along
with associated RA runs certificate management systems to be able to track their responsibilities and
liabilities.

5.1.5 Private Key Tokens


While the public key of a client is stored on the certificate, the associated secret private key can be stored
on the key owner’s computer. This method is generally not adopted. If an attacker gains access to the
computer, he can easily gain access to private key. For this reason, a private key is stored on secure
removable storage token access to which is protected through a password.
Different vendors often use different and sometimes proprietary storage formats for storing keys. For
example, Entrust uses the proprietary .epf format, while Verisign, GlobalSign, and Baltimore use the
standard .p12 format.

Page 10 of 10

You might also like