Unit 4
Unit 4
105
106
4.1 Introduction to Cryptography
Cryptography is a mathematical technique designed tosecure communication between the sender and
the intended recipient of a confidential message. This technique converts the original message into an
encrypted message format which is sent to the intended recipient and can only be read by the intended
recipient by converting it back to the original message.Cryptography comes from the Greek word
kryptos, which means "hidden". Cryptography involves encrypting ordinary text (also known as
plaintext) by some scrambling technique to convert it to ciphertext. The reverse process is applied at
the receiving end to convert the ciphertext back to plaintext using another process known as decryption.
In addition to this, cryptography is also involved in the obfuscation of confidential information in
images/audio/video/text format using a technique known as steganography. Ancient Egyptians devised
some methods in complex hieroglyphics, and one of the first modern ciphers was introduced by Roman
Emperor Julius Caesar and popularly known as Caesar's cipher.
The most common use of cryptography is in digital communication. Encryption and decryption of e-
mail and other plaintext messages are an example of cryptography. The most
straightforwardcryptography technique uses a standard secret key (a symmetric key) between a sender
and receiver). Data to be communicated (plaintext) is encrypted at the sender's end using this secret
key, and this encrypted message (known as ciphertext)is sent to the recipient. The recipient decrypts
the ciphertext using the secret key and extracts the original plaintext.This technique is termed
symmetric key cryptography as encryption and decryption of the messages are performed using the
same secret key. If an intruder intercepts the transmitted message (ciphertext), he cannot decrypt the
encrypted message as the secret key is not known to the intruder. But the problem is to generate and
share the secret kay between two entities. If the sender generates the secret key and sends it to the
receiver, the chances of leakage of the secret key arise. To handle this problem, asymmetric key
cryptography was devised. This is also known as public-key cryptography. Every user holds set of two
keys: one public key and one private key. These pairs of keys are mathematically related and these key
pairs are generated using a complex algorithm. To start secure communication, the sender requests the
recipient's public key. The sender then encrypts the message and sends it to the receiver using this
public key. When the receiver receives the encrypted message, he uses his private key to decrypt it.
Any third party who intercepts the transmitted message cannot decrypt the message as the only private
key of the intended recipient can successfully decrypt the message.
4.2.1 Confidentiality
Confidentiality or privacy is the secrecy of the information while in storage or in transit. This security
goal ensures that only the sender and receiver are able to access the confidential information shared
between them. Confidentiality is said to be compromised if the confidential information is accessed
by or leaked to an unauthorized person.
For example, Consider the situation of sharing confidential information between sender A and receiver
B. When A sends the information to B, it is intercepted by an intruder, C. Now C has access to the
confidential information.
107
4.2.2 Integrity
The integrity goal is to ensure that the information received is not tempered during transit and is
accurate. If an intruder modifies the message in transit and the receiver receives this tempered message,
then the integrity of the message is lost.
4.2.3 Authentication
Authentication is a mechanism to verify the sender of a message, the user using the services, system,
or entity. This mechanism recognizes/confirms the identity of a person trying to get access to the
system or information. The most popular authentication mechanism is the use of username and
password pair to identify an entity. The identities of all authorized users are recorded in the
authentication system. Whenever users try to access the system or information, they need to prove
their identity by submitting a username and password pair.
4.2.4 Non-Repudiation
Non-repudiation is a legal aspect of security and it prevents the denial of the generation and
transmission of the message sent on the network.The sender after sending the message later may
deny it. The mechanism of non-repudiation ensures that the sender can not deny the act of generating
and sending a message as some legal proofs are recorded when a message is sent.
4.3 What Is Encryption?
Encryption is a process of scrambling data or transforming dataso that only authorized recipients can
understand the information. It is transforming plaintext to incomprehensible text, known as ciphertext.
The encryption takes readable plaintext in the simplest form and scrambles it to look like a random
sequence of characters.The encryption process involves use of a secret cryptographic key shared
between the sender and recipient of the message. Every time a given message is encrypted using
different keys, it generates different ciphertexts.
Though the encrypted data (ciphertext) appears random, it is generated using a known algorithm. If
the secret key is known, the receiver can decrypt the ciphertext and convert it back to plaintext. Truly
secure encryption is one that uses a sufficiently long secret key complex enough that attackers cannot
decrypt and find the plaintext using trial and error or brute force technique.
4.4 How Does Encryption Work?
Encryption uses algorithms and secret keys to scramble your information and generate encrypted text.
It is then transmitted to the intended receiver, who can use a similar algorithm to decrypt the encrypted
message using the a secret key.There are wide variety of cryptographicencryption and decryption
algorithms, each one uses different ways of scrambling and encrypting the data.
108
Figure 1: Encryption and decryption
Source: https://cologix.com/resources/blogs/cyber-smarts-integrity-hashing/
109
Institute of Standards and Technology (NIST) released the standard in 1977. For the past 30 years,
this has been the most widely used block cipher.
DES is a block cipher encrypts and decrypts 64-bit blocks, as shown in Figure 2.
Let's just emphasis on the encryption procedure because the decryption process is very similar to the
encryption process. The Feistel cypher encryption procedure begins with initial permutations (P-
boxes) and ends with final permutations, with sixteen cycles. A different 48 bit key is utilised for
each round. A 56-bit primary key and a round key generation procedure are used to generate these
sixteen 48-bit keys. The components of the DES encryption mechanism are shown in Figure 3.
110
Initial and Final Permutations
Figure 4 shows the initial and final permutations (P-boxes). These are straight permutation boxes
having 64-bit input and 64-bit output. Input bits are scrambled in a predefined way and scrambled
output is generated. These permutations do not make use of any key and are inverse of each other. For
example, in the initial permutation, the 2ndbit of input becomes 8th bit of output, and in final
permutation 8th bit of input becomes the 2nd bit in output. In other words, if 16 rounds do not exist
between initial and final permutation, the bit pattern at output side of final permutation is same as bit
pattern at input side of initial permutation.
Table 1, shows the permutation rules for these two P-boxes. Each permutation table is made up of 64
items and can be considered of as a 64-entry array. The input port number is defined by the value of
each element in the table, and the output port number is defined by its index
111
Table 1: Initial and final Permutations
These are keyless, pre-determined permutations that have no cryptographic importance in DES.
Rounds in DES
DES uses 16 rounds. Each round of DES is a Feistel cipher, as shown in Figure 5.
Round I's input is the 64-bit output of the preceding round (I-1) or the output of the initial
permutation. Round I's 64-bit input is split into two 32-bit pieces, LI1 and RI1, and after processing,
32-bit LI and RI are formed, which are sent to the next round or the final permutation box (for round
16). There are two cypher elements in each round: a mixer and a swapper. These elements can be
reversed. The swapper swaps the left and right halves of the text, while the mixer uses the XOR
function.
Feistel Function
Feistel function is at the heart of DES. To produce a 32-bit output, the Feistel function is applied to a
48-bit round key KI and the rightmost 32-bits (RI1) of the round input. As illustrated in Figure 6, this
function is made up of four parts: an expansion P-box, a whitener (that adds key),
a set of eight S-boxes, and a straight P-box.
112
Figure 6: Feistel function
Source: As Figure 2
Expansion P-box
32-bit RI−1 is expanded into a 48-bit pattern so that it can be XORed with 48-bit round key KI.RI-1 is
split by eight 4-bit portions. After that, each 4-bit sector is enlarged to 6 bits. In DES, this expansion
permutation is pre-determined. Input bits 1, 2, 3, and 4 are duplicated to output bits 2, 3, 4, and 5,
correspondingly, for each segment. Bit 1 of the output comes from the previous section's bit 4; bit 1 of
the next section's output comes from the previous section's bit 1. The same criterion applies to bits 1
and 32 if sections 1 and 8 are considered contiguous portions. Figure 7 shows how expanding P-Box
can be used to expand 32-bit data.
Whitener (XOR)
This simple XOR operation is applied onthe expanded 48-bit right section and the round key.
S-Boxes
Eight S-boxes do the real mixing of bits and create confusion. Each S-boxes uses 6-bit input and
produces 4-bit output.
113
Figure 8: S-Boxes
Source: As Figure 2
The XOR operation divides the 48-bit data into eight 6-bit pieces, each of which is sent into its own
S-box. Each S-box produces a 4-bit chunk and merging these eight 4-bit chunks yields a 32-bit output.
Each box's substitute follows a pre-determined rule based on a four-row, sixteen-column table. As
shown in Figure 9, the combination of bits 1 and 6 of the input determines one of four rows, and the
combination of bits 2 through 5 defines one of sixteen columns.
114
Figure 10: Round key generation in DES
Source: As Figure 9
4.5.2 Advanced Encryption Standard (AES)
Another prominent symmetric key block cypher technique is the AES encryption algorithm (also
known as the Rijndael algorithm), which encrypts one block of 128-bit plain text at a time using keys
of size 128, 192, or 256 bits.
The substitution-permutation, or SP network, is used to design the AES algorithm. It uses multiple
rounds of operations to generate the ciphertext, just like other symmetric key algorithms. The size of
the key utilised determines the number of rounds in the method. 10 rounds are required for 128-bit
keys, 12 rounds for 192-bit keys, and 14 rounds for 256-bit keys. Only one key (128/192/256 bits) is
used, and a key expansion method is employed to generate several round keys from it.
115
Figure 11: Rounds in AES for 128-bit key
Source: As Figure 9
16 bytes of 128-bit input plaintext is written in 4x4 matrix known as state in AES. Each round
consisting of four steps transforms this state into a new state which becomes input to the next round.
Four steps of each round are as follows:
1. SubBytes: Substitution of the bytes
Using predefined S-Boxes, each byte of input block text is substituted by another byte.
116
Figure 13: ShiftRows operation
Source: As Figure 9
117
When done repeatedly in 10/12/14 rounds, these steps ensure that the final ciphertext is
secure.
AES modes
Electronic Code Book (ECB) mode, Cipher Block Chaining (CBC) mode, Cipher Feedback (CFB)
mode, Output Feedback(OFB) mode and Counter (CTR) mode are the five different modes of
operations that can use the AES algorithm and other symmetric key algorithms.
4.5.3 RSA (Rivest–Shamir–Adleman) public key algorithm
The RSA encryption algorithm was developed by RSA Data Security and is a widely used public-key
encryption technique. The RSA algorithm's security is predicated on the difficulty of factoring
extremely large composite numbers. The RSA technique exploits prime factorization as a trap door for
encryption. It is based on the problem of identifying prime factors p and q of a composite number
n=pq. The production of big prime numbers is required to compute an RSA key, which takes a long
time and a lot of computer power. The RSA algorithm has become the industry standard for encrypting
sensitive data sent over the Internet.
Rivest, Shamir, and Adelman, the technique's creators, are known as RSA.
To implement RSA encryption, we need to find two large prime numbers kept secret. Multiplication
of these two large prime numbers becomesthe foundation for RSA. Using complex mathematical
operations, a pair of keys are generated which are to be used as public and private keys.
Steps in RSA Algorithm
Key Generation
You need to generate a pair of keys known as public and private keys before using them for
performing encryption and decryption. These keys are generated using certain variables and
parameters. Complete process is explained in following paper
118
Let p = 17 and q=13.
n= 17x13 = 221, z=(17-1)x(13-1)=16x12=192
Value of public key e can be chosen as a small number 5 as it satisfies the condition 1 < e <z.
d = e-1 mod 192 = 77
Public Key pair = (5,221)
Private Key pair = (77,221)
Encryption of plaintext m=10 is done as c=105 mod 221 = 108.
When ciphertext 108 is decrypted using private key (77,221), we get m=108 77 mod 221 = 10.
4.5.4 Blowfish
Blowfish is a symmetric key block cypher invented by Bruce Schneier in 1993 that is freely available.
Many cypher suites, security protocols, and encryption solutions use the Blowfish algorithm.
Blowfish's security has been thoroughly tested and validated.As Blowfish is available in public
domain, people have done significant amount of cryptanalysis on blowfish ciphers and no one
succeeded in breaking the cipher. Blowfish is considered one of the fastest block ciphers available in
the public domain. It is best suited for a product like SplashID that is used on a wide range of processors
found notebook, desktop computers, and mobile devices.
Schneier designed Blowfish with intend to replace the popular DES algorithm.Significant features of
Blowfish design are key-dependent S-boxes and a key schedule which is highly complex.
Blowfish encrypts 64-bit block at a time and its key length can vary between 32 bits to 448 bits. It uses
16-round of Feistel cipher large number of key-dependent S-boxes.
The action of Blowfish is depicted in the diagram to the left. Each line denotes a 32-bit value. The
algorithm keeps two subkey arrays: an 18-entry P-array and four 256-entry S-boxes. The S-boxes take
an 8-bit input and output a 32-bit result. One P-array entry is used every round, and each half of the
data block is XORed with one of the two remaining unused P-entries after the final round.
The diagram below shows Blowfish's F-function. The function divides the 32-bit input into four 8-bit
parts and each 8-bit part is fed to S-Box which is different for each part. The output of each S-Box is
a 32-bit number. These outputs from S-Boxes are added in modulo 232 and XORed to produce the final
32-bit output.
119
Figure 16:The F-function of Blowfish
Source: As Figure 9
120
Figure 18: 16 rounds of Blowfish
4.5.5 Twofish
Twofish is a 128-bit symmetric block cipher having a key size of any length upto 256-bits. NIST
standards are for 128-, 192-, and 256-bit key sizes. Twofishcan be implemented efficiently on 8-bit as
well as 32-bit processors, smart cards, embedded chips, and similar devices and hardware
implementations are also possible. The algorithm is flexible and can be used in some network
applications where keys are changed frequently and can also be implemented in applications with a
minimal amount of RAM/ROM.
121
Figure 19: Twofish implementation
Source: As Figure 9
As shown in Figure 19, Twofishuses a Feistel network. The input block is divided into two half. The
first half is processed through an F function and then XORed with the second half to generate output
to be fed to the next round.
Twofish cipher has a total of 16 rounds. Two 32-bit words are passed to the F function in each round.
Each 32-bit word is split into four bytes and routed through four separate S-boxes, each of which is
key-dependent. The four output bytes (the S-boxes have 8-bit input and output) are merged into a 32-
bit word using a Maximum Distance Separable (MDS) matrix. The two 32-bit words are then merged
using a Pseudo-Hadamard Transform (PHT), appended to two round subkeys, then XORed with the
text's right half. In addition, there are two 1-bit rotations, one before and one after the XOR. Additional
subkeys are XORed into the text block both before and after the first round in Twofish. This feature
is known as "prewhitening" and "postwhitening."
The round function has bijective steps. In other words, every outcome is possible. We've seen many
attacks on ciphers that lack this characteristic so theybecome non valuable. S-box substitution, an
MDS matrix in GF(28), addition in GF(232), addition in GF(2) (commonly known as XOR), and 1-bit
rotations are all included in the round function. As a result, attacking the algorithm mathematically is
difficult.
The key-dependent S-boxes are intended to resist the two major attacks of the early 1990s—differential
cryptanalysis and linear cryptanalysis—and any future assaults. Too many algorithm designers focus
122
on specific assaults while neglecting to consider resistance to unforeseen threats. Our design
philosophy was a little different: good enough against known attacks, but nasty enough to (hopefully)
fend off unknown attacks. We did this in part by using key-dependent S-boxes.
S-boxes that are key-dependent were not chosen at random, as they were in Blowfish. Instead, we
painstakingly designed S-box building rules and tested them with all 128-bit keys (as well as a subset
of longer keys) to ensure that all S-boxes were indeed strong. We were able to combine the strength
of fixed, strong S-boxes with the strength of secret S-boxes using this method. And, unlike Blowfish
in reduced-round variants, Twofish has no weak keys.
Twofish's MDS matrix has been carefully developed to give good diffusion, preserve its MDS
property even after a 1-bit rotation, and be fast in both hardware and software. This meant we had to
look through all of the matrices available to pick the one that best fit our requirements.
The PHT and key addition provide diffusion between the subblocks and the key. On the Pentium (and
above), we can execute all four additions in only two operations using the LEA instruction.
The round subkeys are carefully calculated using a process related to the S-box building principles to
prevent related-key attacks and guarantee good key mixing. We learned during this process that a good
key schedule is designed in tandem with the cipher, rather than being grafted onto it. We put a lot of
effort into the Twofish key schedule and are pleased with the outcome.
The 1-bit rotation is used to break up the byte structure; otherwise, everything is done in bytes. This
procedure exists to annoy cryptanalysts, and it certainly hampered our efforts to decrypt Twofish.
Prewhitening and postwhitening appear to increase the difficulty of every attack by at least one
round. Keeping the eight XORs in makes sense because they are less expensive than a round.
4.5.6 Format Preserving Encryption (FPE)
FPE (Format-Preserving Encryption) is a new way for encrypting structured data like credit cards and
Social Security numbers. FPE allows data-level encryption to be integrated into legacy business
application frameworks that were previously difficult or impossible to deal with. It encrypts data
without changing its format by combining a documented encryption method with an existing, validated
algorithm. As a result, a powerful encryption technique has been developed that enables for encryption
with little changes to existing apps' functionality.
Voltage's CTO Terence Spies suggested the underlying cryptographic structure of FPE in 2006, and
Voltage has been the leader in the development of FPE and related technologies since then. Voltage
possesses US Patent 7,864,952, which describes the core cryptography of FPE, and it has continued to
build intellectual property around the technology's implementation and application.
Using traditional techniques, small, structured data pieces, such as 16-digit credit card numbers, are
converted into bigger, binary fields. As a result, deploying these algorithms frequently required
updated database and application re-engineering to accommodate the new data quantities and formats.
123
Figure 20: Format Preserving Encryption
Source: As Figure 9
FPE preserves the original format of encrypted data on a character-by-character basis, allowing
encrypted data to "fit" into existing fields without needing database or application schema changes.
124
Figure 21: Hash function
Source: As Figure 9
Hash functions are commonly used for authentication, but they can also be utilized for other
purposes.For cryptography, we need strong hash algorithms. Following are requirements for a strong
hash function:
Determinism — A hashing function is deterministic if it always produces same hash value for
a given content.
Pre-Image Resistance — If message M is hashed to generate hash digest H, then it is infeasible
to obtain the original message M from a given hash digest H. Hence, the hashing process is a
one-way function irreversible.
Collision Resistance — If two messages M1 and M2 are hashed to generate hash digests H1
and H2 respectively, then if H1 is equal to H2, we call it a collision. Collision resistance means
So H1 can not be identical to H2 if M1 and M2 are different. It is computationally infeasible
to find out two messages M1 and M2 that generate the same hash digest.
Avalanche Effect — This means is that if any changes are made to the input of hash function
(changes may be very small like only one bit change), it will result in entirely different hash
digest. So small change in input affects a large number of changes in output, known as the
avalanche effect.
Hash Speed — We need to have faster computation of hash valuesIn many cases, large size
input is fed to the hashing algorithm and we need the results quickly. Faster computation is
considered as an ideal property of any cryptographic hash function.
125
of the input password and if the match is found, authentication is booming, and the user is granted
access.
126
validity expires, the digital certificate verification fails and the owner needs to get the new certificate
issued from certificate authority.
Contents of Digital Certificates
The digital certificate is only available in digital format and includes the following information
about the certificate's owner and certificate authority:
• The owner's name. It combines the owner's name and the directory tree's context (position).
If the owner's common name is PressB, the context is OU=Engineering, and the organisation is
O=ABCDelta, the distinguishing name would be:.CN=PressB.OU=Engineeering.O=ABCDelta
• The public key of the owner.
• The date on which the digital certificate was created.
• The date on which the digital certificate will expire.
• The issuer's distinguished name (distinguished name of the CA).
• The digital signature of the issuer.
• Digital Certificate Security Considerations
A digital certificate alone is not the identity of the certificate holder.Digital certificate owner's digital
signature can be verified using public key present in digital certificate. Public key cryptography
provides this mechanism of verifying someone's digital signature and a digital signature can be forged
127
if private ley is compromised. As a result, the digital certificate's owner must protect the private key
associated with the digital certificate's public key. A digital certificate cannot be misused or falsified
unless it has a private key that corresponds to it.
Certificate Authorities and Trust Hierarchies
Concept of trust is foundation of digital certificates. Each user or organization must decide the trusted
CAs and accept certificates issued by these trusted CAs.
Knowledge of public key cryptography is needed to establish any security service. All users need to
have a public key and for ownership of this public key, they need to get the digital certificate from
some trusted CA. Once the digital certificate is issued, the owner can verify the certificate's authenticity
by verifying the digital signature of issuing CA available in digital certificate. To get the authentic
public key of issuing CA, the user needs a digital certificate of its CA that may have been issued by
some higher level CA. This makes a chain of trust and chain of CAs involved in issuing digital
certificates. Usually, a hierarchy of CAs can issue digital certificates to users or other CAs. CAs
themselves hold a digital certificate issued and signed by higher level CAs.So to verify digital
certificate, a user needs a complete chain of digital certificates from its Ca to the highest level CA in
the hierarchy. Figure 23 shows the complete chain of trust.
Now we can understand that insecure application, when a digital certificate of a subject is sent to a
receiver entity. Along with sender's digital certificate and complete chain of digital certificates (from
its CA to root CA in the hierarchy) are sent to the receiver.
The trust chain starts with the root CA. The root CA signs the root CA's digital certificate. It's
referred to as a self-signed digital certificate. Using its own private key, the root CA signs its
certification and all other certificates issued. The public key of the root CA can be used to
verify the root CA's digital signature. The public-key user must have gotten the root CA's
digital certificate in one of the following methods to establish the entire chain of trust:
128
On a storage media, on registered e-mail, or picked up in person.
• The certificate comes with pre-loaded software obtained from a reputable source or downloaded from
a trusted server.
129
tunnel is established between two entities, and each communication is encrypted at the sender's end
and decrypted at the receiver's end.
IPSec is primarily used to create a dedicated secure tunnel between two hosts that uses IPsec
tunneling to encrypt all communication between the two hosts. It can also be used to encrypt and
secure application layer data, give security to routers delivering data over the Internet, and provide
authentication without encryption.
There are two different modes in which IPsec canbe configured and used:
Transport Mode –End-to-end communications, such as communication between a host and a server,
are handled by transport mode. IP packets are made up of two parts: an IP header and an IP payload.
The IP payload is protected in transport mode. Security activities such as encryption are decided by
the sender and receiver in transport mode.
Tunnel Mode – Tunnel mode is the default mode of operation in IPsec and the entire IP packet is
encrypted by same. It's typically used to encrypt all traffic between two routers/gateways connected
via IPsec VPN tunnels over the Internet. Cryptographic functions such as encryption and
authentication are handled by routers/gateways at both ends of the tunnels, in addition to the sender
and receiver, in tunnel mode of operation.
4.7.2 Point-to-Point Tunneling Protocol (PPTP)
It is also used for VPN. It is a set of communication rules that allow organizations to extend their
private network over the public Internet using a secure virtual private network (VPN).Large
organization having many remote offices can be connected securely using PPTP protocol to create a
larger local area network (LAN ). This extension of LAN is possible using the infrastructure of a wide
area network (WAN), like the network of a public Internet service provider (ISP) or telecom. This
130
private network extension over a public network is cost-effective compared to laying out own network
infrastructure over such distances.
PPTP uses the public network to create a secure tunnel between the host and enterprise server and
securely exchange the data. PPTP VPN is established over TCP/IP-based networks. Remote usersof
an organization can securely access corporate networks over the Internet as if they are physically
present in the corporate network.
Point-to-point protocols are already used on the Internet and the extension of point-to-point network
is PPTP. Microsoft defined standards for this protocol. Later Microsoft worked with Cisco to propose
Layer 2 Tunneling Protocol. The Internet Engineering Task Force (IETF) may adopt these two
protocols as upcoming standards for VPN.
131
Now, suppose the same user utilises L2TP, a point-to-point protocol configured on both ends (the ISP
and the user site). A secure tunnel is built to transmit user data after successful authentication of the
user's connection request. After the tunnel has been established, the user can begin communicating.
The following are some of the benefits of L2TP:
For sensitive applications, high data security is supported.
To ensure confidentiality, high-level encryption is applied.
It provides fast and reliable connectivity.
It is cost-effective, with no further overhead costs after deployment.
It is an industry-standard best suited for the business sector, as it is quick, dependable, scalable,
and versatile.
It offers the best authorization policy for users using VPN authentication..
4.7.4 Secure Socket Tunneling Protocol
It is a protocol used for Virtual Private Network (VPN)introduced by Microsoft. All Microsoft
Windows from Vista onwards are offering support for the SSTP protocol.
This VPN protocol secures the online traffic of data and it is much safer protocol compared to PPTP,
L2TP, and IPSec.
SSTP establishes a secure VPN connection between a client and server. A secure tunnel is established
between client and server,entire traffic passing through this tunnel is encrypted. SSTP transports Point-
to-Point Protocol (PTP) traffic using SSL/TLS channel and this the reason SSTP is more secure
compared to PPTP as it supports integrity check, secure key negotiation and encryption. When a VPN
connection is established between client and server, the server is authenticated but client authentication
is optional.
SSTP works on TCP port 443, the port used by HTTPS traffic.SSTP usually doesn't support VPN
tunnels between two sites. SSTP can also support roaming using SSL transmissions. SSTP supports
only user authentication. It does not support device authentication.
Clientnegotiates the server on port 443. The confirmation process at customer side is as follows: client
obtains server's credentials and a verification process is run, If verification fails, the connection is
simply terminated.After successful server verification, the client HTTPS ask to server and SSTP
132
control parcels. The next step is a point-to-point arrangement and IP interfaces for client and server is
established. Now two sides are ready to exchange data through secure tunnel established.
4.7.5 Secure Sockets Layer (SSL)
Netscape developed secure Sockets Layer (SSL) in mid 1990s while Netscapelaunched its popular
web browser. SSL is having three versions but SSL1.0 was never released to the public, and SSL 2.0
had some serious flaws. SSL 3.0 was released for public in 1996 and it was completely revamped, and
became popular in coming years.
TLS vs. SSL
The SSL protocol was adopted and standardized by the Internet Engineering Task Force (IETF), and
it was given the moniker Transport Layer Security (TLS). These two comparable protocols are
sometimes grouped together as SSL/TLS and are updated as a series of protocols.
The TLS protocol can handle all types of internet traffic including web application and website
traffic.If a website address (URL) starts with "https", then the browser is connected to the website
using TLS protocol. There is a padlock on the browser address bar,that tells you that your connection
is secure.
TLS can also be used for other applications like e-mail and UseNet.
Encryption is used to secure the communication over the Internet. If data you are sending over the
Internet is not encrypted, anyone can view the data that is being communicated and accessconfidential
information. The most secure encryption method is public-key cryptography.A pair of public and
private keys is used for encryption and decryption. These keys are using complex mathematics and are
mathematically related. It is nearly impossible to derive the private key using brute force or reverse
engineering knowing the public key. The public key is used to encrypt the data at sender's end and
when encrypted dat reached receiver side, private key is used to decrypt the encrypted data. You can
think of the public key as a location of a mailbox and a slot on the front of a mailbox through which
you can push the letters inside the mailbox and the private key as the key to unlock the mailbox and
take the letters out. Anyone who knows the location of the mailbox can put the message into mailbox,
but if someone need to read these messages, they need the private key.
133
There is a drawback of using public key cryptography for encryption and decryption of all
communication happening. Public key cryptography systems consume much time and computational
resources in encrypting and decrypting the information as complex mathematical operations are
involved. So if this public key cryptography is used for all the communication taking place during
entire session, the system will become slow and lot of computing resources will be involved.SSL/TLS
solves this problem and use public key cryptography only at beginning of the session to establish the
symmetric key between two entities. This happens during handshake phase of the protocol when some
parameters are established between two entities and a symmetric key is established. This symmetric
key becomes available with both the entities and later used to encrypt and decrypt the messages during
entire session. Symmetric key cryptography, where a single key is used for encryption and decryption,
is comparatively efficient and faster than asymmetric key cryptography (public key cryptography).
Since the session and session key are established using public key cryptography, the whole session is
much more secure.
Establishing the session key is known a Handshake and it’s a part of SSL/TLS protocol. Using
handshake protocol, two communicating entities introduce each other, authenticate each other, get to
know their cryptographic capabilities, and agree upon a session key.
SSL handshake
The handshake process little more complicated while some variations are allowed depending upon the
requirements. Here are steps involved during handshake process.
The client initiates the connection and makes a request to the server for a new secure connection. The
server responds with a list of cryptographic parameter options called cipher suites. This cipher suite is
set of supported algorithms for encryption, signature, authentication etc. the server supports. The client
compares the server list with own capabilities, selects algorithms and informs the server about its
selection. Both client and server have agreed to use a predecided cipher suite for a complete session.
The server then sends its digital certificate to verify the authenticity and identity of the server. This
server certificate also contains a server public key to verify the certificate itself and later used to
establish the session key.
Now client and server exchange some parameters and establish a session key using public key
cryptography. This newly created session key will be used to encrypt and decrypt entire
communication during the session using symmetric key cryptography. There are several techniques
for creating the session key. The client may encrypt a random number using server public key and
sends it to the server to decrypt it. Now both the client and server are holding the random number,
which they use to create the session key. Alternately, client and server can use popular key exchange
algorithm-called Diffie–Hellman key exchange to create the session key.
The session key established between client and server is a symmetric cryptography key and will be
used only for this single communication session. Suppose connection between client and server is
interrupted or remains idle for long time. In that case, the server terminated the current session, and
handshake protocol is again used to establish a new session key.
What is an SSL certificate?
134
Let's return to the SSL certificate concept. As described in the previous section, these certificates are
at the heart of the SSL/TLS system: they supply the client with the public cryptographic key required
to begin secure connections. However, their role extends beyond simply supplying the key; they also
verify that the key is indeed associated with the company that is providing it to the client.
What is the mechanism behind this? Certificates are issued by Certificate Authorities (CAs), which
function similarly to a passport office in terms of verifying identities. Organizations that want to
provide TLS-encrypted services must buy certificates from CAs, who then verify that the organizations
are who they say they are. For example, if you wanted to get a certificate to secure a website at
example.com, you'd have to show the CA that you own the domain name example.com. If someone
goes to example.com and receives a valid SSL certificate from a trustworthy CA, they can be certain
that they're dealing with the legitimate owner of the domain. As a result, man-in-the-middle attacks
can be avoided.
In the last paragraph, you'll notice that we used the word "trusted CA." Anyone can start up shop as a
certificate authority; how do you know which ones do the necessary due diligence to authenticate their
clients? Fortunately, software developers are mostly responsible for figuring this out. The Mozilla
Foundation keeps track of which CAs Firefox will trust, and Apple and Microsoft keep track of which
CAs they implement at the OS level for Windows, macOS, and iOS, which Chrome uses on those
systems. As a 2017 fight between Google and Symantec over what Google perceived to be Symantec's
inadequate standards shown, choosing which CAs to trust has high consequences.
The X.509 standard is used to define SSL certificates. This standard permits certificates to convey a
lot more information than simply the public key and the proven identity of the certificate owner;
DigiCert provides a full analysis of the standard in its knowledge base.
SSL checkers
When you communicate with servers that offer TLS-encrypted connections, almost all of the above
information is exchanged and confirmed behind the scenes. You can use an SSL checker website to
acquire a bit more transparency by entering the URL of an SSL/TLS-encrypted site. The checker will
return a variety of details about the certificate used by the tested site, including the server type,
which web browsers will and will not trust it, the issuer, the serial number, and the expiration date.
Most SSL checkers are free services provided by CAs as marketing tools for their products; for
example, many will allow you to set an alert for when an examined certificate expires, assuming that
it's your certificate and you'll be looking for a new one as the expiration date approaches. If you're
looking for a less commercial option, try Qualys SSL Labs' SSL checker, which delivers a very
comprehensive collection of information about inspected websites.
4.7.6 Hypertext Transfer Protocol Secure (HTTPS)
The popular Hyper Text Transfer Protocol (HTTP) was unsecure protocol and security was dependent
upon the application using HTTP. Later a secured version of HTTP known as Hypertext transfer
protocol secure (HTTPS) was proposed, This protocol now ensures secure communication between
browser and web application. HTTPS encrypts every piece of data moving between browser and web
server and ensures data security.This is particularly necessary when sensitive data is shared between
users and web apps.
HTTPS should be used on any website, especially those that require login credentials. Websites that
do not employ HTTPS are marked differently in current web browsers like Chrome than those that
135
do. A green padlock in the URL bar indicates that the webpage is secure. Online browsers take
HTTPS seriously, with Google Chrome and other browsers flagging any non-HTTPS websites as
insecure.
How does HTTPS work?
To encrypt communications, HTTPS employs an encryption protocol. The protocol is now known as
Transport Layer Security (TLS), however, it was previously known as Secure Sockets Layer (SSL)
(SSL). An asymmetric public key infrastructure is used to secure communications in this protocol.
This type of security mechanism encrypts communications between two parties using two separate
keys:
The private key – It is owned by the website's owner and is kept confidential, as the reader would have
guessed. This key is stored on a web server and is used to decrypt data that has been encrypted using
the public key.
The public key –It is accessible to anyone who wishes to interact with the server in a secure manner.
Only the private key can decrypt information encrypted with the public key. Why is HTTPS important?
What happens if a website doesn't have HTTPS?
HTTPS protects websites from having their data broadcast in a way that anyone spying on the network
can see. When data is transferred via standard HTTP, it is split down into packets of data that can be
easily "sniffed" with free software. As a result, communication over an insecure channel, such as public
Wi-Fi, is extremely sensitive to eavesdropping. In fact, all HTTP communications are in plain text,
making them extremely accessible to anyone with the right tools and open to on-path assaults.
HTTPS encrypts traffic so that even if packets are sniffed or otherwise intercepted, they will appear as
nonsensical characters.
136