Skip to content

Commit 2ee9d9f

Browse files
authored
# general editing and minor wording changes (#1475)
1 parent 25a7252 commit 2ee9d9f

File tree

1 file changed

+43
-45
lines changed

1 file changed

+43
-45
lines changed

docs/labs/security/lab9-cryptography.md

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33

44
## Objectives
55

6-
After completing this lab, you will be able to
6+
After completing this lab, you will be able to:
77

88
- apply cryptographic concepts in securing data and communication
99

1010
Estimated time to complete this lab: 120 minutes
1111

12-
13-
1412
## Common Cryptography terms and definitions
1513

1614
### Cryptography
@@ -27,19 +25,19 @@ Cryptology is the discipline of cryptography and cryptanalysis combined. Cryptol
2725

2826
### Encryption
2927

30-
Encryption is the transformation of data into a form that is as close to impossible as possible to read without the appropriate knowledge (e.g. a key). Its purpose is to ensure privacy by keeping information hidden from anyone for whom it is not intended.
28+
Encryption transforms data into a form that is close to impossible to read without the appropriate knowledge (e.g., a key). Its purpose is to ensure privacy by keeping information hidden from anyone for whom it is not intended.
3129

3230
### Decryption
3331

34-
Decryption is the reverse of encryption; it is the transformation of encrypted data back into an intelligible form.
32+
Decryption is the reverse of encryption; it transforms encrypted data into an intelligible form.
3533

3634
### Cipher
3735

3836
A method of encryption and decryption is called a cipher.
3937

4038
Hash Functions (Digest algorithms)
4139

42-
Cryptographic hash functions are used in various contexts, for example to compute the message digest when making a digital signature. A hash function compresses the bits of a message to a fixed-size hash value in a way that distributes the possible messages evenly among the possible hash values. A cryptographic hash function does this in a way that makes it extremely difficult to come up with a message that would hash to a particular hash value. Some examples of the best known and most widely used hash functions are described below.
40+
Cryptographic hash functions are used in various contexts, for example to compute the message digest when making a digital signature. A hash function compresses the bits of a message to a fixed-size hash value to distribute the possible messages evenly among the possible hash values. A cryptographic hash function does this in a way that makes it extremely difficult to come up with a message that would hash to a particular hash value. Below are some examples of the best-known and most widely used hash functions.
4341

4442
**a)** - **SHA-1 (Secure Hash Algorithm)** -This is a cryptographic hash algorithm published by the United States Government. It produces a 160 bit hash value from an arbitrary length string. It is considered to be very good.
4543

@@ -49,37 +47,37 @@ Cryptographic hash functions are used in various contexts, for example to comput
4947

5048
It describes a step-by-step problem-solving procedure, especially an established, recursive computational procedure for solving a problem in a finite number of steps. Technically, an algorithm must reach a result after a finite number of steps. The efficiency of an algorithm can be measured as the number of elementary steps it takes to solve the problem. There are two classes of key-based algorithms. They are:
5149

52-
**a) **-- **Symmetric Encryption Algorithms ( secret-key)**
50+
**a) **-- **Symmetric Encryption Algorithms (secret-key)**
5351

5452
Symmetric algorithms use the same key for encryption and decryption (or the decryption key is easily derived from the encryption key). Secret key algorithms use the same key for both encryption and decryption (or one is easily derivable from the other). This is the more straightforward approach to data encryption, it is mathematically less complicated than public-key cryptography. Symmetric algorithms can be divided into stream ciphers and block ciphers. Stream ciphers can encrypt a single bit of plaintext at a time, whereas block ciphers take a number of bits (typically 64 bits in modern ciphers), and encrypt them as a single unit. Symmetric algorithms are much faster to execute on a computer than asymmetric ones.
5553

5654
Examples of symmetric algorithms are: AES, 3DES, Blowfish, CAST5, IDEA and Twofish.
5755

5856
**b) -- Asymmetric algorithms (Public-key algorithms)**
5957

60-
Asymmetric algorithms on the other hand use a different key for encryption and decryption, and the decryption key cannot be derived from the encryption key. Asymmetric ciphers permit the encryption key to be public, allowing anyone to encrypt with the key, whereas only the proper recipient (who knows the decryption key) can decrypt the message. The encryption key is also called the public key and the decryption key the private key or secret key.
58+
Asymmetric algorithms on the other hand use a different key for encryption and decryption, and the decryption key cannot be derived from the encryption key. Asymmetric ciphers permit the encryption key to be public, allowing anyone to encrypt with the key, whereas only the proper recipient (who knows the decryption key) can decrypt the message. The encryption key is also called the public key, and the decryption key is the private or secret key.
6159

62-
RSA is probably the best known asymmetric encryption algorithm.
60+
RSA is probably the best-known asymmetric encryption algorithm.
6361

6462
### Digital Signature
6563

66-
A digital signature binds a document to the owner of a particular key. Digital signatures are used to verify that a message really comes from the claimed sender.
64+
A digital signature binds a document to the owner of a particular key.
6765

68-
The digital signature of a document is a piece of information based on both the document and the signer's private key. It is typically created through the use of a hash function and a private signing function (encrypting with the signer's private key). A digital signature is a small amount of data that was created using some secret key, and there is a public key that can be used to verify that the signature was really generated using the corresponding private key.
66+
The digital signature of a document is a piece of information based on both the document and the signer's private key. It is typically created through a hash function and a private signing function (encrypting with the signer's private key). A digital signature is a small amount of data created using some secret key, and there is a public key that can be used to verify that the signature was generated using the corresponding private key.
6967

7068
Several methods for making and verifying digital signatures are freely available but the most widely known algorithm is the RSA public-key algorithm.
7169

7270
### Cryptographic Protocols
7371

74-
Cryptography works on many levels. On one level you have algorithms, such as block ciphers and public key cryptosystems. Building upon these you obtain protocols, and building upon protocols you find applications (or other protocols). Below is a list of common everyday applications that make use of cryptographic protocols. These protocols are built on lower level cryptographic algorithms.
72+
Cryptography works on many levels. On one level you have algorithms, such as block ciphers and public key cryptosystems. Building upon these, you obtain protocols, and upon protocols, you find applications (or other protocols). Below is a list of typical everyday applications that use cryptographic protocols. These protocols are built on lower level cryptographic algorithms.
7573

7674
i.) Domain Name Server Security (DNSSEC)
7775

7876
This is a protocol for secure distributed name services. It is currently available as an Internet Draft.
7977

8078
ii.) Secure Socket Layer (SSL)
8179

82-
SSL is one of the two protocols used for secure WWW connections (the other is SHTTP). WWW security has become important as, increasing amounts of sensitive information, such as credit card numbers, are being transmitted over the Internet.
80+
SSL is one of the two protocols used for secure WWW connections (the other is SHTTP). WWW security has become necessary as increasing amounts of sensitive information, such as credit card numbers, are transmitted over the Internet.
8381

8482
iii.) Secure Hypertext Transfer Protocol (SHTTP)
8583

@@ -93,17 +91,17 @@ v) SSH2 Protocol
9391

9492
This protocol is versatile for the needs of the internet, and is currently used in the SSH2 software. The protocol is used to secure terminal sessions and TCP connections.
9593

96-
The following exercises examine two particular applications that make use of cryptographic protocols - GnuPG and OpenSSH.
94+
The following exercises examine two applications that use cryptographic protocols - GnuPG and OpenSSH.
9795

9896
## Exercise 1
9997

10098
### GnuPG
10199

102-
GnuPG (GNU Privacy Guard) is a set of programs for public key encryption and digital signatures. The tools can be used to encrypt data and to create digital signatures. It also includes an advanced key management facility. GnuPG uses public-key cryptography to enable users to communicate securely
100+
GnuPG (GNU Privacy Guard) is a set of programs for public key encryption and digital signatures. The tools can be used to encrypt data and to create digital signatures. It also includes an advanced key management facility. GnuPG uses public-key cryptography to enable users to communicate securely.
103101

104102
Perform the following exercises as a regular user. e.g. user ying
105103

106-
To create a new keypair
104+
To create a new key pair
107105

108106
1. Log into the system as user “ying”
109107

@@ -117,7 +115,7 @@ If it isn’t, get the super-user to install it.
117115

118116
3. List and make a note of all the hidden directories in your home directory.
119117

120-
4. List the keys you currently have in your key-ring. Type:
118+
4. List the keys you currently have in your keyring. Type:
121119

122120
`[ying@serverXY ying]$ gpg --list-keys`
123121

@@ -149,25 +147,25 @@ Please select what kind of key you want:
149147
Your selection? 1
150148
```
151149

152-
At the prompt for the type of key your want to create accept the default i.e.(DSA and ElGamal). Type 1
150+
At the prompt for the type of key you want to create, accept the default, i.e.(DSA and ElGamal). Type 1
153151

154152
!!! WARNING
155153

156-
Option (1) will create two key-pairs for you. The DSA key-pair will be the primary keypair - for making digital signatures and a subordinate ELGamel keypair for data encryption.
154+
Option (1) will create two key-pairs for you. The DSA key-pair will be the primary key pair - for making digital signatures and a subordinate ELGamel key pair for data encryption.
157155

158-
6. You will create an ELG-E keysize of 1024. Accept the default again at the prompt below:
156+
6. You will create an ELG-E key size of 1024. Accept the default again at the prompt below:
159157

160-
DSA keypair will have 1024 bits.
158+
DSA key pair will have 1024 bits.
161159

162-
About to generate a new ELG-E keypair.
160+
About to generate a new ELG-E key pair.
163161

164-
minimum keysize is 768 bits
162+
minimum key size is 768 bits
165163

166-
default keysize is 1024 bits
164+
default key size is 1024 bits
167165

168-
highest suggested keysize is 2048 bits
166+
highest suggested key size is 2048 bits
169167

170-
What keysize do you want? (1024) 1024
168+
What key size do you want? (1024) 1024
171169

172170
7. Create keys that will expire in a year. Type “1y” at the prompt below:
173171

@@ -282,7 +280,7 @@ sub 1024g/1EDB00AC 2003-10-16 \[expires: 2004-10-15\]
282280

283281
<span id="anchor-2"></span>Revocation certificates
284282

285-
Revocation certificates are used revoking keys in case someone gets knowledge of your secret key or incase you forget your passphrase. They are also useful for other various functions.
283+
Revocation certificates are used to revoke keys in case someone gets knowledge of your secret key or in case you forget your passphrase. They are also useful for other various functions.
286284

287285
To create a revocation certificate
288286

@@ -308,9 +306,9 @@ The whole point of all this encrypting, signing and decrypting business is becau
308306

309307
With that said - the perhaps not to so obvious has to be stated:
310308

311-
To communicate with other people using a public-key based cryptosystem - you must exchange public keys.
309+
You must exchange public keys to communicate with other people using a public-key-based cryptosystem..
312310

313-
Or at least make your public key available in any publicly accessible place (Bill-boards, web pages, key servers, radio, T.V, SPAMMING via e-mail ..etc ….. )
311+
Or at least make your public key available in any publicly accessible place (Bill-boards, web pages, key servers, radio, T.V, SPAMMING via e-mail ..etc)
314312

315313
To export your public keys
316314

@@ -336,17 +334,17 @@ To export your public keys
336334

337335
3. Use the cat command to view the binary version of ying’s public key (ying-pub.gpg)
338336

339-
4.   (To reset your terminal type: “reset”)
337+
4. (To reset your terminal type: “reset”)
340338

341339
5. Use the cat command to view the ASCII version of ying’s public key (ying-pub.asc)
342340

343-
6. You will observe that the ASCII version is more suited for posting on web-pages or spamming etc..
341+
6. You will observe that the ASCII version is more suited for posting on web-pages or spamming etc.
344342

345343
## Exercise 3
346344

347345
### Digital signatures
348346

349-
Creating and verifying signatures uses the public/private keypair in an operation different from encryption and decryption. A signature is created using the private key of the signer. The signature can be verified using the corresponding public key.
347+
Creating and verifying signatures uses the public/private key pair, which differs from encryption and decryption. A signature is created using the private key of the signer. The signature can be verified using the corresponding public key.
350348

351349
To digitally sign a file
352350

@@ -362,7 +360,7 @@ To digitally sign a file
362360

363361
Input your passphrase when prompted.
364362

365-
The above command will create another file “secret1.txt.gpg” which is compressed and has a signature attached to it. Run the “file” command on the file to check this. View the file with cat
363+
The above command will create another file “secret1.txt.gpg” which is compressed and has a signature attached to it. Run the “file” command on the file to check this. View the file with cat
366364

367365
4. Check the signature on the signed “secret1.txt.gpg” file. Type:
368366

@@ -374,7 +372,7 @@ gpg: Good signature from "Ying Yang (my test) &lt;ying@serverXY&gt;"
374372

375373
5. Create another file secret2.txt with the text “ Hello All” in it.
376374

377-
6. Sign the secret2.txt file but this time let the file be ASCII armored. Type:
375+
6. Sign the secret2.txt file, but let the file be ASCII armored this time. Type:
378376

379377
\[ying@serverXY ying\]$ ***gpg -sa secret2.txt***
380378

@@ -402,7 +400,7 @@ MAKE SURE THAT YOUR PARTNER HAS PERFORMED THE WHOLE OF
402400

403401
IF YOU DON’T HAVE A PARTNER. LOG OFF USER YING’s ACCOUNT AND LOG INTO THE SYSTEM AS THE USER “me”.
404402

405-
THEN REPEAT THE WHOLE OF “EXECISES -1,2,3” AS THE USER “me”.
403+
THEN REPEAT THE WHOLE OF “EXERCISES -1,2,3” AS THE USER “me”.
406404

407405
YOU MAY THEN PERFORM EXERCISE 4 BELOW. REPLACE ALL REFERENCES TO THE USER YING AT “serverPR” WITH - USER “me” AT serverXY (i.e. your localhost)
408406

@@ -412,23 +410,23 @@ AS YOUR PARTNER IN THE NEXT EXERCISE.
412410

413411
## Exercise 4
414412

415-
In this exercise you will begin the actual communication with another user, using the so called “Web of Trust”.
413+
In this exercise, you will use the so-called “Web of Trust” to communicate with another user.
416414

417415
Importing public keys
418416

419-
1. Log into the system as user ying.
417+
1. Log into the system as user ying./
420418

421419
2. Make your ASCII-armored public-key file (ying-pub.asc) available to your partner ( use
422420

423421
either - me@serverXY or ying@serverPR)
424422

425423
NOTE:
426424

427-
There are several ways of doing this e.g. e-mail, copying and pasting, scp, ftp, Saving on a diskette etc...
425+
There are several ways of doing this e.g. e-mail, copying and pasting, scp, ftp, Saving on a diskette etc.
428426

429427
Select the most efficient method for yourself.
430428

431-
3. Ask your partner to also make their public-key file available to you.
429+
3. Ask your partner to make their public key file available to you.
432430

433431
4. Assuming your partner’s public key is store in a file called “ me-pub.asc” in your pwd;
434432

@@ -560,7 +558,7 @@ It is a FREE version of the SSH protocol suite of network connectivity tools. Op
560558

561559
It helps to provide secure encrypted communications between two untrusted hosts over an insecure network (such as the internet).
562560

563-
It includes both the server side components and the client side suite of programs.
561+
It includes both the server-side components and the client-side suite of programs
564562

565563
**sshd**
566564

@@ -570,19 +568,19 @@ It forks a new daemon for each incoming connection. The forked daemons handle ke
570568

571569
authentication, command execution, and data exchange. According to sshd’s man page, sshd works as follows:
572570

573-
For SSH protocol version 2…..
571+
For SSH protocol version 2:
574572

575573
Each host has a host-specific key (RSA or DSA) used to identify the host. When the daemon starts, it does not generate a server key (As is the case in SSH protocol version 1). Forward security is provided through a Diffie-Hellman key agreement. This key agreement results in a shared session key.
576574

577575
The rest of the session is encrypted using a symmetric cipher, currently 128 bit AES, Blowfish, 3DES, CAST128, Arcfour, 192 bit AES, or 256 bit AES. The client selects the encryption algorithm to use from those offered by the server. Additionally, session integrity is provided through a cryptographic message authentication code (hmac-sha1 or hmac-md5).
578576

579-
Protocol version 2 provides a public key based user (PubkeyAuthentication) or client host (HostbasedAuthentication) authentication method, conventional password authentication and challenge response based methods.
577+
Protocol version 2 provides a public key-based user (PubkeyAuthentication) or client host (HostbasedAuthentication) authentication method, conventional password authentication, and challenge response-based methods.
580578

581579
The SSH2 protocol implemented in OpenSSH is standardized by the “IETF secsh” working group
582580

583581
ssh
584582

585-
The clients suite of programs include “ssh”. This is a program used for logging into remote systems and can also be used for executing commands on remote systems.
583+
The client's suite of programs include “ssh”. This is a program used for logging into remote systems and can also be used for executing commands on remote systems.
586584

587585
## Exercise 5
588586

@@ -780,13 +778,13 @@ To use scp
780778

781779
### Creating User Public and Private keys for SSH
782780

783-
Each individual user that wants to use SSH with RSA or DSA authentication needs a set of public keys and private keys. The ssh-keygen program can be used to create these keys ( just as it was used earlier when you created spare keys for your system)
781+
Each user who wants to use SSH with RSA or DSA authentication needs a set of public and private keys. The ssh-keygen program can be used to create these keys ( just as it was used earlier when you created spare keys for your system)
784782

785783
The only “advised” difference when creating user keys is to also create a passphrase.
786784

787785
The passphrase is a password that the is used to encrypt the private key before it is stored on the file system.
788786

789-
The public is store in a file with the same file name as the private key but with the extension “.pub” appended to it. There is no way to recover a lost passphrase. If the passphrase is lost or forgotten, a new key must be generated.
787+
The public is store in a file with the same file name as the private key but with the extension “.pub” appended to it. There is no way to recover a lost passphrase. A new key must be generated if the passphrase is lost or forgotten.
790788

791789
To create ying’s authentication keys
792790

0 commit comments

Comments
 (0)