17 Security
17 Security
17 Security
17.1 Encryption
Key terms
Eavesdropper – a person who intercepts data being Symmetric encryption – encryption in which the same
transmitted. secret key is used to encrypt and decrypt messages.
Plaintext – the original text/document/message before Key distribution problem – security issue inherent in
it is put through an encryption algorithm. symmetric encryption arising from the fact that, when
Ciphertext – the product when plaintext is put through sending the secret key to a recipient, there is the risk
an encryption algorithm. that the key can be intercepted by an eavesdropper/
Block cipher – the encryption of a number of contiguous hacker.
bits in one go rather than one bit at a time. Asymmetric encryption – encryption that uses public
Stream cipher – the encryption of bits in sequence as keys (known to everyone) and private keys (secret keys).
they arrive at the encryption algorithm. Public key – encryption/decryption key known to all
Block chaining – form of encryption, in which the users.
previous block of ciphertext is XORed with the block of Private key – encryption/decryption key which is known
plaintext and then encrypted thus preventing identical only to a single user/computer.
plaintext blocks producing identical ciphertext.
410
17.1 Encryption
the data is sensitive (for example, medical or legal documents) or confidential
(for example, credit card or bank details).
There are four main security concerns when data is transmitted: confidentiality,
authenticity, integrity and non-repudiation.
1 Confidentiality is where only the intended recipient should be able to read
or decipher the data.
2 Authenticity is the need to identify who sent the data and verify that the
source is legitimate.
3 Integrity is that data should reach its destination without any changes.
4 Non-repudiation is that neither the sender nor the recipient should be able
to deny that they were part of the data transmission which just took place.
▲ Figure 17.1
Note that, when encrypting text, block cipher is usually used. Here, the
encryption algorithm is applied to a group of contiguous bits (for example,
128 bits) rather than one bit at a time (which is known as stream cipher).
With block cipher, each plaintext block is XORed with the previous ciphertext
block and then encrypted – this is known as block chaining. This prevents
identical blocks of plaintext producing the same ciphertext each time they are
encrypted.
Notice the use of encryption and decryption keys in Figure 17.1. These keys will
be considered in the next section.
411
17
after the 10-denary-digit secret key is applied:
C O M P U T E R S C I E N C E I S E X C I T I N G
Key 4 2 9 1 3 6 2 8 5 6 4 2 9 1 3 6 2 8 5 6 4 2 9 1 3
G Q V Q X Z G Z X I M G W D H O U M C I M V R O J
▲ Figure 17.2
17 Security
However, modern computers could ‘crack’ this key (and, therefore, decrypt the
message) in a few seconds. To combat this, we use 256-bit encryption (in other
words, a 256-bit key) which gives 2256 possible combinations. Even this may not
be enough, as computers become more powerful.
One issue with symmetric encryption is that both sender and recipient need
to use the same secret key. This is a security risk here, since the sender has to
supply the key to the recipient. This key could be intercepted. This is referred
to as the key distribution problem.
So, how can both sender and receiver have the required secret key without
sending it electronically? The following routine shows one possibility.
Both sender and recipient end up with the same encryption and decryption key
of 9. This is oversimplified; in practice, computers would generate much larger
keys (possibly 256 bits – equivalent to 64 denary digits if using BCD).
There are many other ways to keep the encryption key secret. But the issue of
security is always the main drawback of symmetrical encryption, since a single
key is required for both sender and recipient.
412
17.1 Encryption
Asymmetric encryption uses two keys – a public key, available to all users,
and a private key, known to a specific person or computer.
Suppose Tom and Meera work for the same company. Tom wishes to send a
confidential document to Meera. Here’s how he could do it.
Step 1: Tom and Meera both use an algorithm to generate their own matching
pairs of keys (private and public) which they keep stored on their computers.
The matching pairs of keys are mathematically linked but cannot be derived
from each other.
Step 2:
Step 3: Tom now uses Meera’s public key (▦) to encrypt the document he wishes
to send to her. He then sends his encrypted document (ciphertext) to Meera.
Step 4: Meera uses her matching private key (▧) to unlock Tom’s document and
decrypt it. This works because the public key used to encrypt the document
and the private key used to decrypt it are a matching pair generated on Meera’s
computer.
Meera can exchange her public key with any number of people working in
the company, so she is able to receive encrypted messages (which have been
encrypted using her public key) and she can then decrypt them using her
matching private key:
Meera
▦ public key
▧ private key
▲ Figure 17.4
17
their own private key to decrypt information being sent to them.
However, there are still issues. For example, how can Meera be certain that
the document came from Tom, and that it has not been tampered with
during transmission? Additional security is required; this will be discussed in
Section 17.4.
Key terms
Quantum cryptography – cryptography to securely send encryption keys over
based on the laws of quantum fibre optic networks.
mechanics (the properties of photons). Qubit – the basic unit of a quantum of
Quantum key distribution (QKD) – information (quantum bit).
protocol which uses quantum mechanics
▲ Figure 17.5
414
17
‘B’ using the QKD protocol?
Stage 1: The sender uses a light source to generate photons.
Stage 2: The photons are sent through four random polarisers (see Figure 17.2)
which randomly give one of four possible polarisations and bit values:
Stage 3: The polarised photon travels along a fibre optic cable to its
destination.
Stage 4: At the destination, there are two beam splitters:
Stage 5: One of the two beam splitters is chosen at random and the photon
detectors are read.
Stage 6: The whole process is repeated until the whole of the encryption key
has been transmitted from ‘A’ to ‘B’.
Stage 7: The recipient sends back the sequence of beam splitters that were
used (for example, XXXYYXXYYXXYYYYY) to the sender.
Stage 8: The sender now compares this sequence to the polarisation sequence
used at the sending station.
Stage 9: The sender now informs the recipient where in the sequence the
correct beam splitters were used.
Stage 10: This now ensures that the sender and recipient are fully synchronised.
Stage 11: The encryption key can again be sent and received safely; even if
intercepted, the eavesdropper would find it almost impossible to read the
encryption key making the whole process extremely secure. Encrypted messages
can now be sent along the fibre optic cable with the decryption key being used
to decode all messages.
Despite the advantages of quantum cryptography, there are some potential
drawbacks:
» It requires a dedicated line and specialist hardware, which can be expensive
to implement initially.
» It still has a limited range (at the time of writing the limit is about 250 km).
» It is possible for the polarisation of the light to be altered (due to various
conditions) while travelling down fibre optic cables.
» Due to the inherent security system generated by quantuin cryptography,
terrorists and other criminals can use the technology to hide their activities
from government law enforcers.
415
between two devices. This is initiated by one device Public key infrastructure (PKI) – a set of protocols,
sending a message to another device requesting the standards and services that allow users to
exchange of data. authenticate each other using digital certificates
Session caching – function in TLS that allows a issued by a CA.
previous computer session to be ‘remembered’,
The two main protocols used to ensure security when using the internet are
Secure Sockets Layer (SSL) and Transport Layer Security (TLS); these are
both part of the transport layer discussed in Chapter 14.
TLS is the more modern; it is based on SSL. The primary use of SSL and TLS is
in the client/server application (see Chapter 2). They both use the standard
cryptographic protocols to ensure there is a secure and authenticated
communication between client and server. However, normally only the server
is authenticated with the client remaining unauthenticated. Once a secure link
between server and client is established, SSL or TLS protocols ensure no third
party can eavesdrop.
secure https://www.xxxx.org/documents
http://www.yyy.co.uk/documents
▲ Figure 17.6
17.3 Protocols
over the internet
» using instant messaging
» making use of a social networking site.
Session caching
When opening a TLS session, it requires considerable computer time (due mainly
to complex cryptographic processes taking place). The use of session caching
can avoid the need to utilise as much computer time for each connection. TLS
can either establish a new session or attempt to resume an existing session;
using the latter can considerably boost the system performance.
Summary
As already indicated, two of the main functions of SSL/TLS are
» the encryption of data
» the identification of client and server to ensure each knows who they are
communicating with.
417
17
key, several steps will occur before any actual encrypted data is sent; this is
known as the handshaking stage.
Stage 2: The client’s browser now requests secure pages (https) from the web
server.
Stage 3: The web server sends back the SSL digital certificate (which also
contains the public key) – the certificate is digitally signed by a third party
called the certificate authority (CA) (see Section 17.4.2).
17 Security
Stage 4: Once the client’s browser receives the digital certificate, it checks
– the digital signature of the CA (is it one of those in the browser’s trusted
store – a list of trusted CAs is part of the browser which the client
downloads to their computer)
– if the start and end dates shown on the certificate are still valid
– if the domain listed in the certificate is an exact match with the domain
requested by the client in the first place.
Stage 5: Once the browser trusts the digital certificate, the public key (which
forms part of the digital certificate) is used by the browser to generate a
temporary session key with the web server; this session key is then sent back
to the web server.
Stage 6: The web server uses its private key to decrypt the session key
and then sends back an acknowledgement that is encrypted using the same
session key.
Stage 7: The browser and web server can now encrypt all the data/traffic sent
over the connection using this session key; a secure communication can now
take place.
The public key infrastructure (PKI) is a set of protocols, standards and
services that allow clients and servers to authenticate each other using digital
certificates issued by the CA (for example, X509, PKI X.509); digital signatures
also follow the same protocol. PKI requires the provider to use an encryption
algorithm to generate public and private keys.
418
419
17 plaintext hashing
digest
873add9ed80
asymmetric
sender cryptographic
document algorithm 4fc5ce0338d2
sender’s algorithm
private e9f7e0962
key
plaintext document
17 Security
digest
if the two digests match 873add9ed80
then the document has 4fc5ce0338d2
not been tampered with e9f7e0962
▲ Figure 17.7
However, this method still is not safe enough, since the public key could be
forged by a third party, which means the recipient still cannot be certain that
the message came from a legitimate source. Therefore, an even more robust
system is needed to give confidence that the sender is really who they claim
to be.
420
17
shows what a typical SSL digital certificate looks like.
user/company id
this is the
address of the examples of CA
company, what the digital
include:
they do, etc. certificate is then
Symantec,
sent back to the
Entrust, etc.
applicant
▲ Figure 17.8
PayWebsite, Inc.
Secure Connection
PayWebsite, Inc.
San Jose
California, US
▲ Figure 17.9
421
17
they could produce their own digital certificate).
However, if a user attempts to log onto my-site.com they might see an error
screen, like this:
Go Back Advanced
▲ Figure 17.10
ACTIVITY 17A
For each of the following questions, choose the B it is rarely used any more
option which corresponds to the correct response. C the value of the key reads the same in both
1 What is meant by the term cipher when used in directions
cryptography? D it only works on computers with older
A an encryption or decryption algorithm operating systems
B an encrypted message E there is a security problem when
C a type of session key transmitting the secret key
D a digital signature 5 Which of the following is the correct name for
a form of encryption in which both the sender
E text following an encryption algorithm
and the recipient use the same key to encrypt/
2 When carrying out asymmetric encryption, decrypt?
which of the following users would keep the
A symmetric key encryption
private key?
B asymmetric key encryption
A the sender
C public key encryption
B the receiver
D same key encryption
C both sender and receiver
E block cipher encryption
D all recipients of the message
6 Which of the following is involved in temporary
E none of the above
key generation?
3 In cryptography, which of the following is the
A session keys
term used to describe the message before it is
encrypted? B private key and certificate
A simpletext C public key and certificate
B plaintext D master keys
C notext E public keys
D ciphertext 7 Which of the following is a correct statement
about PKIs?
E firsttext
A they use private and public keys but not
4 Which of the following is the biggest
digital certificates
disadvantage of using symmetric encryption?
B they use digital signatures and public keys
A it is very complex and time consuming
422
423
17
Re-order the following stages, 1-6, to show how an SSL digital certificate is used
to set up a secure connection between client (user) and website. [6]
order stage
browser and web server now encrypt all data/traffic sent over the connection
using the session key and a secure communication can now take place
client’s browser requests secure pages (https) from the web server
once trusted, the browser uses public key to agree temporary session key with
17 Security
424