cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · web viewrait’s firm...

84
1 Department of Computer Engineering Lab Manual Odd Semester

Upload: tranque

Post on 31-Jan-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

1

Department of Computer EngineeringLab Manual

Final Year Semester-VII

Subject: Cryptography and System Security

Odd Semester

Page 2: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Institutional Vision, Mission and Quality Policy

Our Vision

To foster and permeate higher and quality education with value added engineering, technology programs, providing all facilities in terms of technology and platforms for all round development with societal awareness and nurture the youth with international competencies and exemplary level of employability even under highly competitive environment so that they are innovative adaptable and capable of handling problems faced by our country and world at large.

RAIT’s firm belief in new form of engineering education that lays equal stress on academics and leadership building extracurricular skills has been a major contribution to the success of RAIT as one of the most reputed institution of higher learning. The challenges faced by our country and world in the 21 Century needs a whole new range of thought and action leaders, which a conventional educational system in engineering disciplines are ill equipped to produce. Our reputation in providing good engineering education with additional life skills ensure that high grade and highly motivated students join us. Our laboratories and practical sessions reflect the latest that is being followed in the Industry. The project works and summer projects make our students adept at handling the real life problems and be Industry ready. Our students are well placed in the Industry and their performance makes reputed companies visit us with renewed demands and vigour.

Our MissionThe Institution is committed to mobilize the resources and equip itself with men and materials of excellence thereby ensuring that the Institution becomes pivotal center of service to Industry, academia, and society with the latest technology. RAIT engages different platforms such as technology enhancing Student Technical Societies, Cultural platforms, Sports excellence centers, Entrepreneurial Development Center and Societal Interaction Cell. To develop the college to become an autonomous Institution & deemed university at the earliest with facilities for advanced research and development programs on par with international standards. To invite international and reputed national Institutions and Universities to collaborate with our institution on the issues of common interest of teaching and learning sophistication.

RAIT’s Mission is to produce engineering and technology professionals who are innovative and inspiring thought leaders, adept at solving problems faced by our nation and world by providing quality education.

The Institute is working closely with all stake holders like industry, academia to foster knowledge generation, acquisition, dissemination using best available resources to address the great challenges being faced by our country and World. RAIT is fully dedicated to provide its students skills that make them leaders and solution providers and are Industry ready when they graduate from the Institution.

2

Page 3: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Our Quality PolicyIt is our earnest endeavour to produce high quality engineering professionals who are innovative and inspiring, thought and action leaders, competent to solve problems faced by society, nation and world at large by striving towards very high standards in learning, teaching and training methodologies.Our Motto: If it is not of quality, it is NOT RAIT!Dr. Vijay D. Patil President, RAES

We at RAIT assure our main stakeholders of students 100% quality for the programmes we deliver. This quality assurance stems from the teaching and learning processes we have at work at our campus and the teachers who are handpicked from reputed institutions IIT/NIT/MU, etc. and they inspire the students to be innovative in thinking and practical in approach. We have installed internal procedures to better skills set of instructors by sending them to training courses, workshops, seminars and conferences. We have also a full-fledged course curriculum and deliveries planned in advance for a structured semester long programme. We have well developed feedback system employers, alumni, students and parents from to fine tune Learning and Teaching processes. These tools help us to ensure same quality of teaching independent of any individual instructor. Each classroom is equipped with Internet and other digital learning resources.

The effective learning process in the campus comprises a clean and stimulating classroom environment and availability of lecture notes and digital resources prepared by instructor from the comfort of home. In addition, student is provided with good number of assignments that would trigger his thinking process. The testing process involves an objective test paper that would gauge the understanding of concepts by the students. The quality assurance process also ensures that the learning process is effective. The summer internships and project work based training ensure learning process to include practical and industry relevant aspects. Various technical events, seminars and conferences make the student learning complete.

Our Quality Policy

3

Page 4: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Departmental Vision, Mission

VisionTo impart higher and quality education in computer science with value added engineering and technology programs to prepare technically sound, ethically strong engineers with social awareness. To extend the facilities, to meet the fast changing requirements and nurture the youths with international competencies and exemplary level of employability and research under highly competitive environments.

MissionTo mobilize the resources and equip the institution with men and materials of excellence to provide knowledge and develop technologies in the thrust areas of computer science and Engineering. To provide the diverse platforms of sports, technical, co-curricular and extracurricular activities for the overall development of student with ethical attitude. To prepare the students to sustain the impact of computer education for social needs encompassing industry, educational institutions and public service. To collaborate with IITs, reputed universities and industries for the technical and overall upliftment of students for continuing learning and entrepreneurship.

4

Page 5: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Departmental Program Educational Objectives (PEOs)

1. Learn and Integrate

To provide Computer Engineering students with a strong foundation in the mathematical,

scientific and engineering fundamentals necessary to formulate, solve and analyze

engineering problems and to prepare them for graduate studies.

2. Think and Create

To develop an ability to analyse the requirements of the software and hardware, understand

the technical specifications, create a model, design, implement and verify a computing system

to meet specified requirements while considering real-world constraints to solve real world

problems.

3. Broad Base

To provide broad education necessary to understand the science of computer engineering and

the impact of it in a global and social context.

4. Techno-leader

To provide exposure to emerging cutting edge technologies, adequate training &

opportunities to work as teams on multidisciplinary projects with effective communication

skills and leadership qualities.

5. Practice citizenship

To provide knowledge of professional and ethical responsibility and to contribute to society

through active engagement with professional societies, schools, civic organizations or other

community activities.

6. Clarify Purpose and Perspective

To provide strong in-depth education through electives and to promote student awareness on

the life-long learning to adapt to innovation and change, and to be successful in their

professional work or graduate studies.

5

Page 6: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Departmental Program Outcomes (POs)

Pa. Foundation of computing - An ability to apply knowledge of computing, applied mathematics, and fundamental engineering concepts appropriate to the discipline.

Pb. Experiments & Data Analysis - An ability to understand, identify, analyze and design the problem, implement and validate the solution including both hardware and software.

Pc. Current Computing Techniques – An ability to use current techniques, skills, and tools necessary for computing practice.

Pd. Teamwork – An ability to have leadership and management skills to accomplish a common goal.

Pe. Engineering Problems - an ability to identify, formulates, and s olve engineering problems.

Pf. Professional Ethics – An understanding of professional, ethical, legal, security and social issues and responsibilities.

Pg. Communication – An ability to communicate effectively with a range of audiences in both verbal and written form.

Ph. Impact of Technology – An ability to analyse the local and global impact of computing on individuals, organizations, and society.

Pi. Life-long learning – An ability to recognize the need for, and an ability to engage in life-long learning.

Pj. Contemporary Issues – An ability to exploit gained skills and knowledge of contemporary issues.

Pk. Professional Development – Recognition of the need for and an ability to engage in continuing professional development and higher studies.

Pl. Employment - An ability to get an employment to the international repute industries through the training programs, internships, projects, workshops and seminars.

6

Page 7: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

IndexSr. No. Contents Page No.

1. List of Experiments 8

2.Experiment Plan ,Course Objectives & Course

Outcomes9

3.Mapping of Course Outcomes – Program

Outcomes10

4. Study and Evaluation Scheme 11

5. Experiment No. 1 12

6. Experiment No. 2 19

7. Experiment No. 3 23

8. Experiment No. 4 27

9. Experiment No. 5 34

10. Experiment No. 6 38

11. Experiment No. 7 42

12. Experiment No. 8 46

13. Experiment No. 9 50

14. Experiment No. 10 54

15. Experiment No. 11 58

List of Experiments

7

Page 8: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Sr. No. Experiments Name1 Write program to encrypt and decrypt using product cipher.

2 Write a program to demonstrate strength of RSA.

3 Write a program to implement Diffie-Hellman Algorithm.

4 Write a program to implement DES algorithm.

5 Write program to demonstrate integrity management by implementing message digest using MD5/SHA.

6 Write a program to demonstrate working of virus.

7 Implement password cracking using ophcrack.

8 Implement SQL Injection using SQLmap.

9 Implement Phishing attack.

10 Write a program to implement DOS/DDOS attack.

11 Study experiment on Email Security using PGP and S/MIME

Experiment Plan, Course Objectives &

Course Outcome8

Page 9: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Course Objectives:

1. To provide students with contemporary knowledge in Cryptography and Security.2. To understand how crypto can be used as an effective tools in providing assurance

concerning privacy and integrity of information.3. To provide skills to design security protocols for recognize security problems.

Course Outcomes:

CO1 Understand the principles and practices of cryptographic techniques.

CO2 Understand the cryptosystem in providing assurance concerning privacy and integrity

of information.

CO3 Appreciate the application of security techniques and technologies in solving real-life

security problems in practical systems.

CO4 Design security protocols and methods to solve the specific security problems.

CO5 Understand a variety of generic security threats and vulnerabilities, and identify & analyze

particular security problems with current research issues.

Module

No.

WeekNo.

Experiments NameCourseOutcom

e

Weightage

(in %)

1 W1Write program to encrypt and decrypt using product cipher.

CO 1 100

2 W2 Write a program to demonstrate strength of RSA. CO 2 303 W3 Write a program to implement Diffie-Hellman

Algorithm.CO 2 30

4 W4 Write a program to implement DES algorithm. CO 2 40

5 W5Write program to demonstrate integrity management by implementing message digest using MD5/SHA.

CO 3 40

6 W6 Write a program to demonstrate working of virus. CO 3 207 W7 Implement password cracking using ophcrack. CO 3 208 W8 Implement SQL Injection using SQLmap. CO 3 209 W9 Implement Phishing attack. CO 5 50

10 W10 Write a program to implement DOS/DDOS attack. CO 5 50

11W11, W12

Study experiment on Email Security using PGP and S/MIME.

CO 4 100

Mapping Course Outcomes (CO) -

Program Outcomes (PO)9

Page 10: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Subject

Weight

Course Outcomes Contribution to Program outcomes

Pa Pb Pc Pd Pe Pf Pg Ph Pi Pj Pk Pl

PR

40%

CO1 : Understand the principles and

practices of cryptographic

techniques.2 2 2 4

CO2 : Understand the

cryptosystem in providing

assurance concerning privacy and

integrity of information.

4 2 2 1 1

CO3 : Appreciate the application of

security techniques and

technologies in solving real-life

security problems in practical

systems.

1 2 2 1 1 1 1 1

CO4 : Design security protocols and

methods to solve the specific

security problems.2 2 3 3

CO5: Understand a variety of

generic security threats and

vulnerabilities, and identify &

analyze particular security problems

with current research issues.

1 1 1 1 1 1 1 1 1 1

Study and Evaluation Scheme

10

Page 11: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Course

CodeCourse Name Teaching Scheme Credits Assigned

CPC702

Cryptography and System

Security

Theory

Practical

Tutorial

Theory

Practical

Tutorial

Total

04 02 -- 04 01 -- 05

Course Code Course Name Examination Scheme

CPC702

Cryptography and System

Security

Term Work Oral Total

25 25 50

Term Work:

1. Term work assessment must be based on the overall performance of the student with

every experiment graded from time to time. The grades should be converted into

marks as per the Credit and Grading System manual and should be added and

averaged.

2. The final certification and acceptance of term work ensures satisfactory performance

of laboratory work and minimum passing marks in term work.

Practical & Oral:

1. Practical & Oral exam will be based on the entire syllabus of Cryptography and

System Security respectively.

11

Page 12: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Cryptography and System Security

Experiment No.: 1

Write program to encrypt and decrypt

using product cipher.

Experiment No. 11. Aim: Write program to encrypt and decrypt using product cipher.

12

Page 13: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

2. Objectives: From this experiment, the student will be able to Understand the encryption and decryption fundamentals. Understand the concepts of the product cipher. Understand the confusion and diffusion properties of a block cipher.

3. Outcomes: The learner will be able to

To apply encrypting knowledge, understand and analyse the problem and provide valid solution.

Understand the professional, ethical, legal, security and social issues and responsibilities.

Identify and formulate the engineering problem.

4. Hardware / Software Required: C/C++/JAVA

5. Theory:

Product Cipher:

In cryptography, a product cipher combines two or more transformations in a manner intending that the resulting cipher is more secure than the individual components to make it resistant to cryptanalysis. The product cipher combines a sequence of simple transformations such as substitution (S-box), permutation (P-box), and modular arithmetic. The concept of product ciphers is due to Claude Shannon, who presented the idea in his foundational paper, Communication Theory of Secrecy Systems.

For transformation involving reasonable number of n message symbols, both of the foregoing cipher systems (the S-box and P-box) are by themselves wanting. Shannon suggested using a combination of S-box and P-box transformation - a product cipher. The combination could yield a cipher system more powerful than either one alone. This approach of alternatively applying substitution and permutation transformation has been used by IBM in the Lucifer cipher system, and has become the standard for national data encryption standards such as the Data Encryption Standard and the Advanced Encryption Standard. A product cipher that uses only substitutions and permutations is called a SP-network. Feistel ciphers are an important class of product ciphers.

What makes a product cipher secure?

Nobody knows how to prove mathematically that a product cipher is completely secure. So in practice one begins by demonstrating that the cipher “looks highly random”. For example, the cipher must be nonlinear, and it must produce ciphertext which functionally depends on every

13

Page 14: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

bit of the plaintext and the key. Meyer has shown that at least 5 rounds of DES are required to guarantee such a dependence. In this sense a product cipher should act as a “mixing” function which combines the plaintext, key, and ciphertext in a complex nonlinear fashion.

Figure 1. A product cipher made of two rounds.

Diffusion and Confusion

Claude Shannon, in one of the fundamental papers on the theoretical foundations of cryptography [“Communication theory of secrecy systems,” Bell Systems Technical Journal 28 (1949), 656 – 715], gave two properties a good cryptosystem should have to hinder statistical analysis: diffusion and confusion.

14

Page 15: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Diffusion means that if we change a character of the plaintext, then several characters of the ciphertext should change, and similarly, if we change a character of the ciphertext, then several characters of the plaintext should change. We saw that the Hill cipher has this property. This means that frequency statistics of letters, [digraphs], etc. in the plaintext are diffused over several characters in the ciphertext, which means that much more ciphertext is needed to do a meaningful statistical attack.

Confusion means that the key does not relate in a simple way to the ciphertext. In particular, each character of the ciphertext should depend on several parts of the key. For example, suppose we have a Hill cipher with an n × n matrix, and suppose we have a plaintext-ciphertext pair of length n2 with which we are able to solve for the encryption matrix. If we change one character of the ciphertext, one column of the matrix can change completely. Of course, it would be more desirable to have the entire key change. When a situation like that happens, the cryptanalyst would probably need to solve for the entire key simultaneously, rather than piece by piece.

The Vigenère and substitution ciphers do not have the properties of diffusion and confusion, which is why they are so susceptible to frequency analysis.

Figure 2. Diffusion and Confusion in a block cipher6. Procedure/ Program:

import java.util.*;

class ProductCipher {public static void main(String args[]) {System.out.println(“Enter the input to be encrypted:”);

15

Page 16: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

String substitutionInput = new Scanner(System.in).nextLine();System.out.println(“Enter a number:”);int n = new Scanner(System.in).nextInt();

// Substitution encryptionStringBuffer substitutionOutput = new StringBuffer();for(int i=0 ; i<substitutionInput.length() ; i++) {char c = substitutionInput.charAt(i);substitutionOutput.append((char) (c+5));}System.out.println(“\nSubstituted text:”);System.out.println(substitutionOutput);

// Transposition encryptionString transpositionInput = substitutionOutput.toString();int modulus;if((modulus = transpositionInput.length()%n) != 0) {modulus = n-modulus;// ‘modulus’ is now the number of blanks/padding (X) to be appendedfor( ; modulus!=0 ; modulus–) {transpositionInput += “/”;}}StringBuffer transpositionOutput = new StringBuffer();System.out.println(“\nTransposition Matrix:”);for(int i=0 ; i<n ; i++) {for(int j=0 ; j<transpositionInput.length()/n ; j++) {char c = transpositionInput.charAt(i+(j*n));System.out.print(c);transpositionOutput.append(c);}System.out.println();}System.out.println(“\nFinal encrypted text:”);System.out.println(transpositionOutput);

// Transposition decryptionn = transpositionOutput.length()/n;StringBuffer transpositionPlaintext = new StringBuffer();for(int i=0 ; i<n ; i++) {for(int j=0 ; j<transpositionOutput.length()/n ; j++) {char c = transpositionOutput.charAt(i+(j*n));transpositionPlaintext.append(c);

16

Page 17: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

}}

7. Results:Output:Enter the input to be encrypted:The quick brown fox jumps over the lazy dog.Enter a number:7

Substituted text:Ymj%vznhp%gwt|s%kt}%ozrux%t{jw%ymj%qf⌂~%itl3

Transposition Matrix:Yhszjqlmp%rwf3j%ku%⌂/%gtxy~/vw}%m%/zt%tji/n|o{%t/

Final encrypted text:Yhszjqlmp%rwf3j%ku%⌂/%gtxy~/vw}%m%/zt%tji/n|o{%t/

Plaintext:The quick brown fox jumps over the lazy dog.

8. Conclusion :

A product cipher is a composite of two or more elementary ciphers with the goal of producing a cipher which is more secure that any of the individual components. A substitution-permutation network is a product cipher composed of stages, each involving substitutions and permutations, in which the blocks can be partitioned into smaller blocks for substitutions and recombined with permutations.

9. Viva Questions:

What is product cipher? What makes a product cipher secure? What is difference between the diffusion and confusion?

10. References:

17

Page 18: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

1. William Stallings, “Cryptography and Network Security: Principles and Practice”, Pearson education, Fifth edition.

2. Bernard Menezes, “Network Security and Cryptography”, Cengage Learning, Second Edition.

3. Behrouz A Forouzan, Debdeep Mukhopadhyay, “Cryptography and Network Security”, Tata McGraw Hill, Second edition

4. Behrouz A. Forouzan, “Cryptography and Network Security”, Tata McGraw Hill.5. Charles P. Pfleeger, “Security in Computing”, Pearson Education.

18

Page 19: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Cryptography and System Security

Experiment No.: 2

Write a program to demonstrate

strength of RSA.

Experiment No. 21. Aim: Write a program to demonstrate strength of RSA.

2. Objectives: From this experiment, the student will be able to Understand the concept of public key cryptosystem. Understand the RSA cryptosystem.

19

Page 20: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Understand the possible attacks on RSA cryptosystem.

3. Outcomes: The learner will be able to Understand the RSA technique skills for computing practice. Understand the professional, ethical, legal, security and social issues and

responsibilities. Recognize the need for RSA, and an ability to engage in life-long learning.

4. Hardware / Software Required: C/C++/JAVA.

5. Theory:

The RSA Cryptosystem

The various observations just stated form the basis for the RSA public-key cryptosystem, which was invented at MIT in 1977 by Ronald Rivest, Adi Shamir and Leonard Adleman.

The public key in this cryptosystem consists of the value n, which is called the modulus, and the value e, which is called the public exponent. The private key consists of the modulus n and the value d, which is called the private exponent.

An RSA public-key / private-key pair can be generated by the following steps:

1. Generate a pair of large, random primes p and q.2. Compute the modulus n as n = pq.3. Select an odd public exponent e between 3 and n-1 that is relatively prime to p-1

and q-1.4. Compute the private exponent d from e, p and q.5. Output (n, e) as the public key and (n, d) as the private key.

The encryption operation in the RSA cryptosystem is exponentiation to the eth power modulo n:

c = ENCRYPT (m) = me mod n (1)

The input m is the message; the output c is the resulting ciphertext. In practice, the message m is typically some kind of appropriately formatted key to be shared. The actual message is encrypted with the shared key using a traditional encryption algorithm. This construction makes it possible to encrypt a message of any length with only one exponentiation.

The decryption operation is exponentiation to the dth power modulo n:m = DECRYPT (c) = cd mod n. (2)

20

Page 21: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

The relationship between the exponents e and d ensures that encryption and decryption are inverses, so that the decryption operation recovers the original message m. Without the private key (n, d) (or equivalently the prime factors p and q), it’s difficult (by CONJECTURE 6) to recover m from c. Consequently, n and e can be made public without compromising security, which is the basic requirement for a public-key cryptosystem.

Key PairPublic key: n = 55, e = 3 Private key: n = 55, d = 7

Key Pair Generation Primes: p = 5, q = 11 Modulus: n = pq = 55 Public exponent: e = 3Private exponent: d = 3-1 mod 20 = 7

Message Encryptionc = m3 mod n

Decryptionm = c7 mod n

m m2 mod n m3 mod n c2 mod n c3 mod n c6 mod n c7 mod n0 0 0 0 0 0 01 1 1 1 1 1 12 4 8 9 17 14 23 9 27 14 48 49 34 16 9 26 14 31 45 25 15 5 20 15 56 36 51 16 46 26 67 49 13 4 52 9 78 9 17 14 18 49 89 26 14 31 49 36 9

6. Procedure/ Program:

i. Choose two large prime numbers P and Q.ii. Calculate N = P × Q.

iii. Select the public key (i.e. the encryption key) E such that it is not a factor of (P-1) and (Q-1).

iv. Select the private key (i.e. the decryption key) E such that the following equation is true: (D × E) mod (P-1) × (Q-1) = 1

v. For encryption, calculate the ciphertext CT from the plain text PT as follows:CT = PTE mod N

vi. Send CT as the cipher text to the receiver.vii. For decryption, calculate the plaintext PT from the ciphertext CT as follows:

PT = CTD mod N.

7. Conclusion:

RSA is a strong encryption algorithm that has stood a partial test of time. RSA implements a public-key cryptosystem that allows secure communications and

21

Page 22: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

“digital signatures”, and its security rests in part on the difficulty of factoring large numbers. The authors urged anyone to attempt to break their code, whether by factorization techniques or otherwise, and nobody to date seems to have succeeded. This has in effect certified RSA, and will continue to assure its security for as long as it stands the test of time against such break-ins.

8. Viva Questions:

What is RSA cryptosystem? What are the different attacks possible on RSA cryptosystem?

9. References:

1. William Stallings, “Cryptography and Network Security: Principles and Practice”, Pearson education, Fifth edition.

2. Bernard Menezes, “Network Security and Cryptography”, Cengage Learning, Second Edition.

3. Behrouz A Forouzan, Debdeep Mukhopadhyay, “Cryptography and Network Security”, Tata McGraw Hill, Second edition

4. Behrouz A. Forouzan, “Cryptography and Network Security”, Tata McGraw Hill.5. Charles P. Pfleeger, “Security in Computing”, Pearson Education.

22

Page 23: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Cryptography and System Security

Experiment No.: 3

Write a program to implement Diffie-

Hellman Algorithm.

Experiment No. 31. Aim: Write a program to implement Diffie-Hellman Algorithm.

2. Objectives: From this experiment, the student will be able to Understand the principles of asymmetric key cryptography.

23

Page 24: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Understand the Diffie-Hellman Key exchange algorithm. Understand the possible attacks on Diffie-Hellman.

3. Outcomes: The learner will be able to Understand the Diffie-Hellman technique skills for computing practice. Understand the professional, ethical, legal, security and social issues and

responsibilities. Recognize the need for Diffe-Hellman, and an ability to engage in life-long

learning.

4. Hardware / Software Required: C/C++/JAVA.

5. Theory:

The Diffie-Hellman Algorithm

Diffie–Hellman key exchange (D–H) is a specific method of securely exchanging cryptographic keys over a public channel and was one of the first public-key protocols as originally conceptualized by Ralph Merkle and named after Whitfield Diffie and Martin Hellman. D–H is one of the earliest practical examples of public key exchange implemented within the field of cryptography. Traditionally, secure encrypted communication between two parties required that they first exchange keys by some secure physical channel, such as paper key lists transported by a trusted courier. The Diffie–Hellman key exchange method allows two parties that have no prior knowledge of each other to jointly establish a shared secret key over an insecure channel. This key can then be used to encrypt subsequent communications using a symmetric key cipher.

The Diffie–Hellman key exchange algorithm solves the following dilemma. Alice and Bob want to share a secret key for use in a symmetric cipher, but their only means of communication is insecure. Every piece of information that they exchange is observed by their adversary Eve. How is it possible for Alice and Bob to share a key without making it available to Eve? At first glance it appears that Alice and Bob face an impossible task. It was a brilliant insight of Diffie and Hellman that the difficulty of the discrete logarithm problemfor F*

p provides a possible solution.

The first step is for Alice and Bob to agree on a large prime p and a nonzero integer g modulo p. Alice and Bob make the values of p and g public knowledge; for example, they might post the values on their web sites, so Eve knows them, too. For various reasons to be discussed later, it is best if they choose g such that its order in F*

p is a large prime.

The next step is for Alice to pick a secret integer a that she does not reveal to anyone, while at the same time Bob picks an integer b that he keeps secret. Bob and Alice use their secret

24

Page 25: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

integers to compute

They next exchange these computed values, Alice sends A to Bob and Bob sends B to Alice. Note that Eve gets to see the values of A and B, since they are sent over the insecure communication channel. Finally, Bob and Alice again use their secret integers to compute

The values that they compute, A0 and B0 respectively, are actually the same, since

This common value is their exchanged key. The Diffie-Hellman key exchange algorithm is summarized in Table

Public Parameter CreationA trusted party chooses and publishes a (large) prime p

and an integer g having large prime order in F∗.

Private ComputationsAlice Bob

Choose a secret integer a.Compute A ≡ ga (mod p).

Choose a secret integer b.Compute B ≡ gb (mod p).

Public Exchange of ValuesAlice sends A to Bob −−−−−−−−−−−−−−−−−−→

A B ←−−−−−−−−−−−−−−−−−− Bob sends B to AliceFurther Private Computations

Alice BobCompute the number Ba (mod p).

Compute the number Ab (mod p).The shared secret value is Ba ≡ (gb)a ≡ gab ≡ (ga)b ≡ Ab (mod p).

Table 1. Diffie-Hellman Key Exchange

6. Procedure/ Program:

i. Firstly, Alice and Bob agree on two large prim numbers, n and g. These two integers need not be kept secret. Alice and Bob can use an insecure channel to agree on them.

ii. Alice chooses another large random number x, and calculates A such that:A = gx mod n

iii. Alice sends the number A to Bob.25

Page 26: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

iv. Bob independently chooses another large random integer y and calculates B such that:

B= gy mod nv. Bob sends the number B to Alice.

vi. A now computes the secret key K1 as follows:K1 = Bx mod n

vii. B now computes the secret key K2 as follows:K2 = Ay mod n

7. Conclusion:

The Diffie-Hellman key exchange algorithm has turned out to be a standout amongst the most fascinating key distribution schemes being used today. Nonetheless, one must know about the way that in spite of the algorithm is safe against passive eavesdropping, it is not necessarily protected from active attacks. Diffie-Hellman algorithm should be complemented with an authentication mechanism. This methodology for key distribution gives off an impression of being one of the favoured routines utilized as a part of practice today.

8. Viva Questions:

Is there any particular reason to use Diffie-Hellman over RSA for key exchange?

Explain the Diffie-Hellman shared key exchange mechanism?

9. References:

1. William Stallings, “Cryptography and Network Security: Principles and Practice”, Pearson education, Fifth edition.

2. Bernard Menezes, “Network Security and Cryptography”, Cengage Learning, Second Edition.

3. Behrouz A Forouzan, Debdeep Mukhopadhyay, “Cryptography and Network Security”, Tata McGraw Hill, Second edition

4. Behrouz A. Forouzan, “Cryptography and Network Security”, Tata McGraw Hill.5. Charles P. Pfleeger, “Security in Computing”, Pearson Education.

26

Page 27: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Cryptography and System Security

Experiment No.: 4

Write a program to implement DES

algorithm.

Experiment No. 41. Aim: Write a program to implement DES algorithm.

2. Objectives: From this experiment, the student will be able to Understand the principles of block ciphers. To describe the details of building elements of DES. Distinguish between DES and Triple DES.

3. Outcomes: The learner will be able to27

Page 28: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Understand the DES technique skills for computing practice. Understand the professional, ethical, legal, security and social issues and

responsibilities. Recognize the need for DES, and an ability to engage in life-long learning.

4. Hardware / Software Required: C/C++/JAVA.

5. Theory:

Data Encryption Standard (DES)

DES encrypts and decrypts data in 64-bit blocks, using a 64-bit key (although the effective key strength is only 56 bits, as explained below). It takes a 64-bit block of plaintext as input and outputs a 64-bit block of ciphertext. Since it always operates on blocks of equal size and it uses both permutations and substitutions in the algorithm, DES is both a block cipher and a product cipher.

DES has 16 rounds, meaning the main algorithm is repeated 16 times to produce the ciphertext. It has been found that the number of rounds is exponentially proportional to the amount of time required to find a key using a brute-force attack. So as the number of rounds increases, the security of the algorithm increases exponentially.

Figure 1. General depiction of DES encryption algorithm

28

Page 29: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Key Scheduling

Although the input key for DES is 64 bits long, the actual key used by DES is only 56 bits in length. The least significant (right-most) bit in each byte is a parity bit, and should be set so that there are always an odd number of 1s in every byte. These parity bits are ignored, so only the seven most significant bits of each byte are used, resulting in a key length of 56 bits.

Figure 2. Key SchedulingThe first step is to pass the 64-bit key through a permutation called Permuted Choice 1, or PC-1 for short. The table for this is given below. Note that in all subsequent descriptions of bit numbers, 1 is the left-most bit in the number, and n is the rightmost bit.

PC-1: Permuted Choice 1

Bit 0 1 2 3 4 5 6

1 57 49 41 33 25 17 9

8 1 58 50 42 34 26 18

15 10 2 59 51 43 35 27

22 19 11 3 60 52 44 36

29 63 55 47 39 31 23 15

29

Page 30: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

36 7 62 54 46 38 30 22

43 14 6 61 53 45 37 29

50 21 13 5 28 20 12 4

For example, we can use the PC-1 table to figure out how bit 30 of the original 64-bit key transforms to a bit in the new 56-bit key. Find the number 30 in the table, and notice that it belongs to the column labelled 5 and the row labelled 36. Add up the value of the row and column to find the new position of the bit within the key. For bit 30, 36 + 5 = 41, so bit 30 becomes bit 41 of the new 56-bit key. Note that bits 8, 16, 24, 32, 40, 48, 56 and 64 of the original key are not in the table. These are the unused parity bits that are discarded when the final 56-bit key is created. Now that we have the 56-bit key, the next step is to use this key to generate 16 48-bit sub keys, called K [1]-K [16], which are used in the 16 rounds of DES for encryption and decryption. The procedure for generating the sub keys - known as key scheduling - is fairly simple:

1. Set the round number R to 1. 2. Split the current 56-bit key, K, up into two 28-bit blocks, L (the left-hand half) and R

(the right-hand half). 3. Rotate L left by the number of bits specified in the table below, and rotate R left by

the same number of bits as well. 4. Join L and R together to get the new K. 5. Apply Permuted Choice 2 (PC-2) to K to get the final K[R], where R is the round

number we are on. 6. Increment R by 1 and repeat the procedure until we have all 16 sub keys K[1]-K[16].

Here are the tables involved in these operations:

Subkey Rotation Table

Round Number 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Number of bits to rotate 1 1 2 2 2 2 2 2 1 2 2 2 2 2 2 1

PC-2: Permuted Choice 2

Bit 0 1 2 3 4 5

30

Page 31: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

1 14 17 11 24 1 5

7 3 28 15 6 21 10

13 23 19 12 4 26 8

19 16 7 27 20 13 2

25 41 52 31 37 47 55

31 30 40 51 45 33 48

37 44 49 39 56 34 53

43 46 42 50 36 29 32

6. Procedure/ Program:

31

Page 32: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

7. Conclusion:

32

Page 33: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Data Encryption Standard is very powerful algorithm. It is much faster than the public key system like RSA. It is also easy to implement in hardware and software. It was tested for about 25 years and no logic flaws were detected. Despite these advantages DES also has some limitations like key transmission of private key over public channel, slower than AES, RC6 and its smaller key length. However, if the key size of DES is made larger which is done in Triple DES, then DES can be very powerful and unbreakable algorithm.

8. Viva Questions:

What is the DES algorithm and what are its variants? What is the basic method used by 3DES to encrypt plaintext?

9. References:

1. William Stallings, “Cryptography and Network Security: Principles and Practice”, Pearson education, Fifth edition.

2. Bernard Menezes, “Network Security and Cryptography”, Cengage Learning, Second Edition.

3. Behrouz A Forouzan, Debdeep Mukhopadhyay, “Cryptography and Network Security”, Tata McGraw Hill, Second edition

4. Behrouz A. Forouzan, “Cryptography and Network Security”, Tata McGraw Hill.5. Charles P. Pfleeger, “Security in Computing”, Pearson Education.

33

Page 34: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Cryptography and System Security

Experiment No.: 5

Write program to demonstrate integrity

management by implementing message

digest using MD5/SHA.

34

Page 35: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Experiment No. 51. Aim: Write program to demonstrate integrity management by implementing message

digest using MD5/SHA.

2. Objectives: From this experiment, the student will be able to Understand the applications of cryptographic hash functions. Distinguish between MD5 & SHA-1. Differentiate between hashing and encryption.

3. Outcomes: The learner will be able to Understand, identify, analyse and design the MD5/SHA problem and

implement a valid solution to it. Apply the current techniques skills in MD5/SHA for computing practice. Recognize the need for MD5/SHA, and an ability to engage in life-long

learning.

4. Hardware / Software Required: C/C++/JAVA.

5. Theory:

MD5 Algorithm

The MD5 message-digest algorithm is a widely used cryptographic hash function producing a 128- bit (16-byte) hash value, typically expressed in text format as a 32-digit hexadecimal number. MD5 has been utilized in a wide variety of cryptographic applications, and is also commonly used to verify data integrity. MD5 was designed by Ronald Rivest in 1991 to replace an earlier hash function, MD4. The source code in RFC 1321 contains a "by attribution" RSA license. In 1996 a flaw was found in the design of MD5. While it was not deemed a fatal weakness at the time, cryptographers began recommending the use of other algorithms, such as SHA-1—which has since been found to be vulnerable as well. In 2004 it was shown that MD5 is not collision resistant. As such, MD5 is not suitable for applications like SSL certificates or digital signatures that rely on this property for digital security. Also in 2004 more serious flaws were discovered in MD5, making further use of the algorithm for security purposes questionable; specifically, a group of researchers described how to create a pair of files that share the same MD5 checksum. Further advances were made in breaking MD5 in 2005, 2006, and 2007. In December 2008, a group of researchers used this technique to fake SSL certificate validity, and CMU Software Engineering Institute now says that MD5 "should be considered cryptographically broken and unsuitable for further use", and most U.S. government. applications now require the SHA-2 family of hash functions. In 2012, the

35

Page 36: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Flame malware exploited the weaknesses in MD5 to fake a Microsoft digital signature. MD5 processes a variable-length message into a fixed-length output of 128 bits. The input message is broken up into chunks of 512-bit blocks (sixteen 32-bit words); the message is padded so that its length is divisible by 512. The padding works as follows: first a single bit, 1, is appended to the end of the message. This is followed by as many zeros as are required to bring the length of the message up to 64 bits fewer than a multiple of 512. The remaining bits are filled up with 64 bits representing the length of the original message, modulo 264. The main MD5 algorithm operates on a 128-bit state, divided into four 32-bit words, denoted A, B, C, and D. These are initialized to certain fixed constants. The main algorithm then uses each 512-bit message block in turn to modify the state. The processing of a message block consists of four similar stages, termed rounds; each round is composed of 16 similar operations based on a non-linear function F, modular addition, and left rotation. Figure 1 illustrates one operation within a round. There are four possible functions F; a different one is used in each round:

Figure 1. Message Digest Algorithm

One MD5 operation. MD5 consists of 64 of these operations, grouped in four rounds of 16operations. F is a nonlinear function; one function is used in each round.

36

Page 37: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

6. Procedure/ Program:

i. Append Padding Bits.ii. Append Length.

iii. Initialize MD Buffer.iv. Process Message in 16-Word Blocks.v. Output.

7. Conclusion:

The algorithm takes as input a message of arbitrary length and produces as output a 128-bit "fingerprint" or "message digest" of the input. It is conjectured that it is computationally infeasible to produce two messages having the same message digest, or to produce any message having a given prespecified target message digest. The MD5 algorithm is intended for digital signature applications, where a large file must be "compressed" in a secure manner before being encrypted with a private (secret) key under a public-key cryptosystem such as RSA. The MD5 algorithm is designed to be quite fast on 32-bit machines. In addition, the MD5 algorithm does not require any large substitution tables; the algorithm can be coded quite compactly.

8. Viva Questions:

How many bits of hash value is produces by MD5? Difference between MD5 & SHA-1.

9. References:

1. William Stallings, “Cryptography and Network Security: Principles and Practice”, Pearson education, Fifth edition.

2. Bernard Menezes, “Network Security and Cryptography”, Cengage Learning, Second Edition.

3. Behrouz A Forouzan, Debdeep Mukhopadhyay, “Cryptography and Network Security”, Tata McGraw Hill, Second edition

4. Behrouz A. Forouzan, “Cryptography and Network Security”, Tata McGraw Hill.5. Charles P. Pfleeger, “Security in Computing”, Pearson Education.

37

Page 38: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Cryptography and System Security

Experiment No.: 6

Write a program to demonstrate

working of virus.

38

Page 39: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Experiment No. 61. Aim: Write a program to demonstrate working of virus.

2. Objectives: From this experiment, the student will be able to Understand the technique of infection. Able to distinguish between viruses, worms and trojans. Understand the modern delivery of viruses.

3. Outcomes: The learner will be able to Understand, identify, analyse and design the virus working problem and

implement a valid solution to it. Apply the current techniques skills in virus implementation for computing

practice. Recognizing the consequences done by virus implementation, and an ability to

engage in life-long learning, also also to understand the professional, ethical, legal, security and social issues and responsibilities.

4. Hardware / Software Required: C/C++/JAVA.

5. Theory:

How Computer Viruses Work

Computer viruses tend to grab our attention. On the one hand, viruses show us how vulnerable we are. A properly engineered virus can have an amazing effect on the worldwide Internet. On the other hand, they show how sophisticated and interconnected human beings have become. For example, experts estimate that the Mydoom worm infected approximately a quarter-million computers in a single day in January 2004. Back in March 1999, the Melissa virus was so powerful that it forced Microsoft and a number of other very large companies to completely turn off their e-mail systems until the virus could be contained. TheILOVEYOU virus in 2000 had a similarly devastating effect. That's pretty impressive when you consider that the Melissa and ILOVEYOU viruses are incredibly simple.

In this article, we will discuss viruses -- both "traditional" viruses and the newer e-mail viruses -- so that you can learn how they work and also understand how to protect yourself. Viruses in general are on the wane, but occasionally a person finds a new way to create one, and that's when they make the news. When you listen to the news, you hear about many different forms of electronic infection. The most common are:

39

Page 40: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

• Viruses - A virus is a small piece of software that piggybacks on real programs. For example, a virus might attach itself to a program such as a spreadsheet program. Each time the spreadsheet program runs, the virus runs, too, and it has the chance to reproduce (by attaching to other programs) or wreak havoc.• E-mail viruses - An e-mail virus moves around in e-mail messages, and usually replicates itself by automatically mailing itself to dozens of people in the victim's emailaddress book.• Worms - A worm is a small piece of software that uses computer networks and security holes to replicate itself. A copy of the worm scans the network for another machine that has a specific security hole. It copies itself to the new machine using the security hole, and then starts replicating from there, as well. • Trojan horses - A Trojan horse is simply a computer program. The program claims to do one thing (it may claim to be a game) but instead does damage when you run it (it may erase your hard disk). Trojan horses have no way to replicate automatically.

6. Procedure/ Program: Program V :={1234567;Subroutine infect-executable:={loop: file=random-executable;if (first-line of file = 1234567)then goto loop;else prepend V to file;}Subroutine do-damage:={whatever damage you can program}Subroutine trigger-pulled:={whatever trigger you want here}Main-program-of-virus:={infect-executable;if (trigger-pulled) then do-damage;goto next;}next:}

7. Conclusion:

Viruses are programs that replicate, evolve, and/or infect. They spread from program to program, user to user, computer to computer, and network to network. Their unique properties are generality, persistence and extent. They are an integrity problem, not a secrecy problem. Therefore, improving computer security to keep secrets better does

40

Page 41: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

not eliminate the virus problem. Similarly, old risk assessment techniques do not apply. Finally, most current systems are extremely vulnerable.

8. Viva Questions:

How does Virus affect the system? How is virus different from worm?

9. References:

1. William Stallings, “Cryptography and Network Security: Principles and Practice”, Pearson education, Fifth edition.

2. Bernard Menezes, “Network Security and Cryptography”, Cengage Learning, Second Edition.

3. Behrouz A Forouzan, Debdeep Mukhopadhyay, “Cryptography and Network Security”, Tata McGraw Hill, Second edition

4. Behrouz A. Forouzan, “Cryptography and Network Security”, Tata McGraw Hill.5. Charles P. Pfleeger, “Security in Computing”, Pearson Education.

41

Page 42: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Cryptography and System Security

Experiment No.: 7

Implement password cracking using

ophcrack.

42

Page 43: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Experiment No. 71. Aim: Implement password cracking using ophcrack.

2. Objectives: From this experiment, the student will be able to Learn the fundamentals of password storing, encrypting and cracking. Evaluate the performance of password cracking using ophcrack tool. Realize the importance of choosing a password that is resistant to these kinds

of attacks

3. Outcomes: The learner will be able to Understand, identify, analyse and design the password cracking problem and

implement a valid solution to it. Apply the current techniques skills in password cracking for computing

practice. Recognize the applications and need password cracking, and an ability to

engage in life-long learning, also to understand the professional, ethical, legal, security and social issues and responsibilities.

4. Hardware / Software Required: Ophcrack.

5. Theory:

Password Cracking

Password cracking refers to various measures used to discover computer passwords. This is usually accomplished by recovering passwords from data stored in, or transported from, a computer system. Password cracking is done by either repeatedly guessing the password, usually through a computer algorithm in which the computer tries numerous combinations until the password is successfully discovered.

Password cracking can be done for several reasons, but the most malicious reason is in order to gain unauthorized access to a computer without the computer owner’s awareness. This results in cybercrime such as stealing passwords for the purpose of accessing banking information.

Other, non-malicious, reasons for password cracking occur when someone has misplaced or forgotten a password. Another example of non-malicious password cracking may take place

43

Page 44: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

if a system administrator is conducting tests on password strength as a form of security so that hackers cannot easily access protected systems.

In cryptanalysis and computer security, password cracking is the process of recovering passwords from data that have been stored in or transmitted by a computer system. A common approach (brute-force attack) is to try guesses repeatedly for the password and check them against an available cryptographic hash of the password.

The purpose of password cracking might be to help a user recover a forgotten password (installing an entirely new password is less of a security risk, but it involves System Administration privileges), to gain unauthorized access to a system, or as a preventive measure by system administrators to check for easily crackable passwords. On a file-by-file basis, password cracking is utilized to gain access to digital evidence for which a judge has allowed access but the particular file's access is restricted.

What is ophcrack?

Ophcrack is a free Windows password cracker based on rainbow tables. It is a very efficient implementation of rainbow tables done by the inventors of the method. It comes with a Graphical User Interface and runs on multiple platforms.

Features of ophcrack:

Runs on Windows, Linux/Unix, Mac OS X, ... Cracks LM and NTLM hashes. Free tables available for Windows XP and Vista/7. Brute-force module for simple passwords. Audit mode and CSV export. Real-time graphs to analyze the passwords. Live CD available to simplify the cracking. Dumps and loads hashes from encrypted SAM recovered from a Windows partition. Free and open source software (GPL).

6. Conclusion:

These common passwords give us an idea of what the typical user's creativity is towards forming a password. Given that these common passwords only make up less than .5% of the passwords used in the pool of stolen passwords, we cannot assume too much, but one can consider that the majority of users use passwords with the same elements as those mentioned above. The most important thing to keep in mind about passwords is that the typical user uses a password that will be easily remembered, thus one that almost always includes a real word of some sort.

44

Page 45: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

7. Viva Questions:

What is password cracking? How many tools are there for password cracking?

8. References:

1. William Stallings, “Cryptography and Network Security: Principles and Practice”, Pearson education, Fifth edition.

2. Bernard Menezes, “Network Security and Cryptography”, Cengage Learning, Second Edition.

3. Behrouz A Forouzan, Debdeep Mukhopadhyay, “Cryptography and Network Security”, Tata McGraw Hill, Second edition

4. Behrouz A. Forouzan, “Cryptography and Network Security”, Tata McGraw Hill.5. Charles P. Pfleeger, “Security in Computing”, Pearson Education.

45

Page 46: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Cryptography and System Security

Experiment No.: 8

Implement SQL Injection using

SQLmap.

46

Page 47: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Experiment No. 81. Aim: Implement SQL Injection using SQLmap.

2. Objectives: From this experiment, the student will be able to Practice various different types of SQL Injection vulnerabilities. Learn advanced identification techniques by which you can spot a SQL

Injection Evaluate SQLmap security scanners/tool and see its working.

3. Outcomes: The learner will be able to Understand, identify, analyse and design the SQLi problem and implement a

valid solution to it. Apply the current techniques skills in SQLi for computing practice. Recognize the applications of SQLi, and an ability to engage in life-long

learning, also to understand the professional, ethical, legal, security and social issues and responsibilities.

4. Hardware / Software Required: SQLmap.

5. Theory:

SQL Injection (SQLi)

SQL injection (SQLi) refers to an injection attack wherein an attacker can execute malicious SQL statements (also commonly referred to as a malicious payload) that control a web application’s database server (also commonly referred to as a Relational Database Management System – RDBMS). Since an SQL injection vulnerability could possibly affect any website or web application that makes use of an SQL-based database, the vulnerability is one of the oldest, most prevalent and most dangerous of web application vulnerabilities.

By leveraging an SQL injection vulnerability, given the right circumstances, an attacker can use it to bypass a web application’s authentication and authorization mechanisms and retrieve the contents of an entire database. SQL injection can also be used to add, modify and delete records in a database, affecting data integrity.

To such an extent, SQL injection can provide an attacker with unauthorized access to sensitive data including, customer data, personally identifiable information (PII), trade secrets, intellectual property and other sensitive information.

47

Page 48: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

How SQL Injection works

In order to run malicious SQL queries against a database server, an attacker must first find an input within the web application that is included inside of an SQL query.

In order for an SQL injection attack to take place, the vulnerable website needs to directly include user input within an SQL statement. An attacker can then insert a payload that will be included as part of the SQL query and run against the database server.

The following server-side pseudo-code is used to authenticate users to the web application.# Define POST variablesuname = request.POST['username']passwd = request.POST['password']

# SQL query vulnerable to SQLisql = “SELECT id FROM users WHERE username=’” + uname + “’ AND password=’” + passwd + “’”

# Execute the SQL statementdatabase.execute(sql)

The above script is a simple example of authenticating a user with a username and a password against a database with a table named users, and a username and password column.

The above script is vulnerable to SQL injection because an attacker could submit malicious input in such a way that would alter the SQL statement being executed by the database server.

A simple example of an SQL injection payload could be something as simple as setting the password field to password’ OR 1=1.

This would result in the following SQL query being run against the database server.

SELECT id FROM users WHERE username=’username’ AND password=’password’ OR 1=1’

An attacker can also comment out the rest of the SQL statement to control the execution of the SQL query further.

48

Page 49: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

-- MySQL, MSSQL, Oracle, PostgreSQL, SQLite' OR '1'='1' --' OR '1'='1' /*-- MySQL' OR '1'='1' #-- Access (using null characters)' OR '1'='1' %00' OR '1'='1' %16

Once the query executes, the result is returned to the application to be processed, resulting in an authentication bypass. In the event of authentication bypass being possible, the application will most likely log the attacker in with the first account from the query result — the first account in a database is usually of an administrative user.

6. Conclusion:

Most of the web applications uses intermediate layer to accept a request from the user and retrieve sensitive information from the database. Most of the time they use scripting language to build intermediate layer. To breach security of database hacker often uses SQL injection techniques. Generally attacker tries to confuse the intermediate layer technology by reshaping the SQL queries. Perhaps, attacker will change the activities of the programmer for their benefits. A number of methods are used to avoid SQL injection attack at application level, but no feasible solution is available yet.

7. Viva Questions:

What is SQLi? How can you prevent SQLi?

8. References:

1. William Stallings, “Cryptography and Network Security: Principles and Practice”, Pearson education, Fifth edition.

2. Bernard Menezes, “Network Security and Cryptography”, Cengage Learning, Second Edition.

3. Behrouz A Forouzan, Debdeep Mukhopadhyay, “Cryptography and Network Security”, Tata McGraw Hill, Second edition

4. Behrouz A. Forouzan, “Cryptography and Network Security”, Tata McGraw Hill.5. Charles P. Pfleeger, “Security in Computing”, Pearson Education.

49

Page 50: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Cryptography and System Security

Experiment No.: 9

Implement Phishing attack.

50

Page 51: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Experiment No. 91. Aim: Implement Phishing attack.

2. Objectives: From this experiment, the student will be able to Understand how phishing attack takes place. Understand the different types of phishing attacks. Understand how phishing scams can be avoided.

3. Outcomes: The learner will be able to Apply the computing knowledge to understand, identify and analyse the

phishing attack problem and apply current techniques to implement the valid solution.

Understand the professional, ethical, legal, security and social issues and responsibilities.

Recognize the consequences of phishing attack, and an ability to engage in life-long learning.

4. Hardware / Software Required: C/C++/JAVA .

5. Theory:

Phishing Attack

Phishing is a form of social engineering in which an attacker, also known as a phisher, attempts to fraudulently retrieve legitimate users’ confidential or sensitive credentials by mimicking electronic communications from a trustworthy or public organization in an automated fashion. The word “phishing” appeared around 1995, when Internet scammers were using email lures to “fish” for passwords and financial information from the sea of Internet users; “ph” is a common hacker replacement of “f”, which comes from the original form of hacking, “phreaking” on telephone switches during 1960s. Early phishers copied the code from the AOL website and crafted pages hat looked like they were a part of AOL, and sent spoofed emails or instant messages with a link to this fake web page, asking potential victims to reveal their passwords.

51

Page 52: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Figure 1. Phishing information flow

A complete phishing attack involves three roles of phishers. Firstly, mailers send out a largenumber of fraudulent emails (usually through botnets), which direct users to fraudulent websites. Secondly, collectors set up fraudulent websites (usually hosted on compromised machines), which actively prompt users to provide confidential information. Finally, cashers use the confidential information to achieve a pay-out. Monetary exchanges often occur between those phishers. The information flow is shown in Figure 1.

Types of Phishing Attack

Phishing has spread beyond email to include VOIP, SMS, instant messaging, social networking sites, and even multiplayer games. Below are some major categories of phishing.

i. Clone Phishing : In this type phisher creates a cloned email. He does this by getting information such as content and recipient addresses from a legitimate email which was delivered previously, then he sends the same email with links replaced by malicious ones. He also employs address spoofing so that the email appears to be from the original sender. The email can claim to be a re-send of the original or an updated version as a trapping strategy.

ii. Spear Phishing: Spear phishing targets at a specific group. So instead of casting out thousands of emails randomly, spear phishers target selected groups of people with something in common, for example people from the same organization. Spear phishing is also being used against high-level targets, in a type of attack called \whaling". For example, in 2008, several CEOs in the U.S. were sent a fake subpoena along with an attachment that would install malware when viewed. Victims of spear phishing attacks in late 2010 and early 2011 include the Australian Prime Minister's office, the Canadian government, the Epsilon mailing list service, HBGary Federal, and Oak Ridge National Laboratory.

52

Page 53: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

iii. Phone Phishing: This type of phishing refers to messages that claim to be from a bank asking users to dial a phone number regarding problems with their bank accounts. Traditional phone equipment has dedicated lines, so Voice over IP, being easy to manipulate, becomes a good choice for the phisher. Once the phone number, owned by the phisher and provided by a VoIP service, is dialled, voice prompts tell the caller to enter her account numbers and PIN. Caller ID spoofing, which is not prohibited by law, can be used along with this so that the call appears to be from a trusted source.

6. Conclusion:

Phishing is a growing crime and one that we must be aware of. Although laws have been enacted, education is the best defence against phishing. Being a bit suspicious of all electronic communications and websites is recommended. Look out for the common characteristics - sense of urgency, request for verification, and grammar and spelling errors. Also, get in the habit of comparing the provided URL with an independent search for the company's website.

7. Viva Questions:

What is a phishing attack? What are the types of phishing attack?

8. References:

1. William Stallings, “Cryptography and Network Security: Principles and Practice”, Pearson education, Fifth edition.

2. Bernard Menezes, “Network Security and Cryptography”, Cengage Learning, Second Edition.

3. Behrouz A Forouzan, Debdeep Mukhopadhyay, “Cryptography and Network Security”, Tata McGraw Hill, Second edition

4. Behrouz A. Forouzan, “Cryptography and Network Security”, Tata McGraw Hill.5. Charles P. Pfleeger, “Security in Computing”, Pearson Education.

.

53

Page 54: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Cryptography and System Security

Experiment No.: 10

Write a program to implement DOS

attack.

54

Page 55: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Experiment No. 101. Aim: Write a program to implement DOS/DDOS attack.

2. Objectives: From this experiment, the student will be able to Understand the concept of DOS attacks. Understand the various types of DOS attacks.

3. Outcomes: The learner will be able to Apply the computing knowledge to understand, identify and analyse the

DOS/DDOS problem and apply current techniques to implement the valid solution.

Understand the professional, ethical, legal, security and social issues and responsibilities.

Recognize the consequences of DOS/DDOS, and an ability to engage in life-long learning.

4. Hardware / Software Required: C/C++/JAVA.

5. Theory:

Denial-of-Service (DOS)

A denial of service attack, often referred to as a “DOS” attack, is a method of stopping a website or service from running. The outcome of this may be causing a website to stop displaying content, or preventing a system that operates on the Internet from working properly. DOS attacks can range in duration and may target more than one site or system at a time. It becomes a distributed DOS, referred to as “DDOS”, when the attack comes from multiple computers (or vectors) instead of one, as is the case in DOS.

A server, or anything connected to the Internet, works by passing data to and from multiple devices in a network, known as nodes. However, each node can only handle a certain amount of traffic – the amount of data being passed between nodes. This happens millions of times a second on the Internet1 but when traffic gets busy, data rates slow down.

A good example of this is ‘Black Friday’ or ‘Cyber Monday’, where millions of people attempt to buy gifts online but can be greeted with error messages rather than the webpage they expect to see. This is because the amount of traffic is too great for the host to handle and so it simply can’t serve each user. There needs to be a two-way communication in order for the customer to be able to interact with the website, but the host has stopped responding because its resources are being completely used up by others.

55

Page 56: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

The communication between (for example) a laptop and a website is happening in the background without the user’s interaction. There are many ways devices communicate on theInternet2 , and this means that there are many different ways in which an attacker can disrupt these services. Many different types of DOS/DDOS attacks exist, all working for slightly different purposes, but the goal is always to ‘deny the service’, by overloading it.

Figure 1. Example of DOS

How does it work?

When a user clicks to load a webpage, a ‘three-way handshake’ begins between the user and the server hosting the webpage, much like making a phone call. A user ‘calls up’ the webpage to initiate a conversation; the webpage answers (“hello?”) and the user responds (“hello, it’s…[name]...”), after that the two participants can converse freely, knowing that each party is active. The diagram shows this handshake between computer and server annotated with their associated flag (SYN and ACK, standing for synchronise and acknowledge). The flags are what is actually communicated by the devices. This process is happening millions of times a day for more popular sites and so the servers that host those sites are designed to handle lots of traffic. A small independent company’s website however, might be hosted on a server that can’t handle as much traffic.

56

Page 57: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

6. Conclusion:

DOS attacks are a significant threat to many online services that are used every day and can cost businesses significant amounts in lost revenue. They can often be a cover for a different kind of cyber-attack, most notably theft from networks. Organisations of all sizes, including small and medium sized enterprises, should take this threats seriously and are recommended to follow the mitigation advice in this paper. With greater cyber awareness and better working practices, the threat from DOS attacks can be reduced and make the world a safer place in which to be online.

7. Viva Questions:

What is DOS/DDOS attack? Give types of DOS/DDOS attacks.

8. References:

1. William Stallings, “Cryptography and Network Security: Principles and Practice”, Pearson education, Fifth edition.

2. Bernard Menezes, “Network Security and Cryptography”, Cengage Learning, Second Edition.

3. Behrouz A Forouzan, Debdeep Mukhopadhyay, “Cryptography and Network Security”, Tata McGraw Hill, Second edition

4. Behrouz A. Forouzan, “Cryptography and Network Security”, Tata McGraw Hill.5. Charles P. Pfleeger, “Security in Computing”, Pearson Education.

57

Page 58: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Cryptography and System Security

Experiment No.: 11

Study experiment on Email Security

using PGP and S/MIME

58

Page 59: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

Experiment No. 111. Aim: Study experiment on Email Security using PGP and S/MIME.

2. Objectives: From this experiment, the student will be able to Understand the need for email security. Understand the how PGP ensures email security. Understand the how S/MIME ensures email security.

3. Outcomes: The learner will be able to Understand the global impact of email security problem on individuals,

organizations & society. Engage leadership & management skills to understand the email security

problem. Understand, identify, analyse the email security problem and implement a

valid solution to it.

4. Theory:

Email Security: PGP & S/MIME

In virtually all distributed environments, electronic mail is the most heavily used network-based application. Users expect to be able to, and do, send e-mail to others who are connected directly or indirectly to the Internet, regardless of host operating system or communications suite. With the explosively growing reliance on e-mail, there grows a demand for authentication and confidentiality services. Two schemes stand out as approaches that enjoywidespread use: Pretty Good Privacy (PGP) and S/MIME.

PGP (Pretty Good Privacy)

PGP is a remarkable phenomenon. Largely the effort of a single person, Phil Zimmermann, PGP provides a confidentiality and authentication service that can be used for electronic mail and file storage applications. In essence, Zimmermann has done the following:

1. Selected the best available cryptographic algorithms as building blocks.2. Integrated these algorithms into a general-purpose application that is

independent of operating system and processor and that is based on a small set of easy-to-use commands.

3. Made the package and its documentation, including the source code, freely available via the Internet, bulletin boards, and commercial networks such as AOL (America On Line).

59

Page 60: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

4. Entered into an agreement with a company (Viacrypt, now Network Associates) to provide a fully compatible, low-cost commercial version of PGP.

Figure 1. Summary of PGP services

Figure 2. PGP cryptographic functions

S/MIME

Secure/Multipurpose Internet Mail Extension (S/MIME) is a security enhancement to the MIME Internet e-mail format standard based on technology from RSA Data Security. Although both PGP and S/MIME are on an IETF standards track, it appears likely that S/MIME will emerge as the industry standard for commercial and organizational use, while

60

Page 61: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

PGP will remain the choice for personal e-mail security for many users. S/MIME is defined in a number of documents—most importantly RFCs 3370, 3850, 3851, and 3852.

In terms of general functionality, S/MIME is very similar to PGP. Both offer the ability to sign and/or encrypt messages. In this subsection, we briefly summarize S/MIME capability. We then look in more detail at this capability by examining message formats and message preparation.

S/MIME provides the following functions.

i. Enveloped data: This consists of encrypted content of any type and encrypted contentencryption keys for one or more recipients.

ii. Signed data: A digital signature is formed by taking the message digest of the content to be signed and then encrypting that with the private key of the signer. The content plus signature are then encoded using base64 encoding. A signed data message can only be viewed by a recipient with S/MIME capability.

iii. Clear-signed data: As with signed data, a digital signature of the content is formed. However, in this case, only the digital signature is encoded using base64.As a result, recipients without S/MIME capability can view the message content, although they cannot verify the signature.

iv. Signed and enveloped data: Signed-only and encrypted-only entities may be nested, so that encrypted data may be signed and signed data or clear-signed data may be encrypted.

Figure 1. Cryptographic Algorithms used in S/MIME

61

Page 62: cebdiv.weebly.comcebdiv.weebly.com/uploads/3/8/1/6/38163583/css__201…  · Web viewRAIT’s firm belief in new form of engineering education that lays equal stress on academics

The following rules, in the following order, should be followed by a sending agent.

i. If the sending agent has a list of preferred decrypting capabilities from an intended recipient, it SHOULD choose the first (highest preference) capability on the list that it is capable of using.

ii. If the sending agent has no such list of capabilities from an intended recipient but has received one or more messages from the recipient, then the outgoing message SHOULD use the same encryption algorithm as was used on the last signed and encrypted message received from that intended recipient.

iii. If the sending agent has no knowledge about the decryption capabilities of the intended recipient and is willing to risk that the recipient may not be able to decrypt the message, then the sending agent SHOULD use triple DES.

iv. If the sending agent has no knowledge about the decryption capabilities of the intended recipient and is not willing to risk that the recipient may not be able to decrypt the message, then the sending agent MUST use RC2/40.

5. Conclusion:

To summarize the state of secure e-mail software, we can say that software exists now to establish trust between two individuals or within a small group so they can exchange text-based e-mail. Such software has actually been available for some time, but the quality and ease of use of available implementations has recently begun to improve. Software is available to PGP & secure MIME-based e-mail in a similar manner, although it is not nearly as widespread and is mostly available commercially.

6. Viva Questions:

What is PGP? What is S/MIME?

7. References:

1. William Stallings, “Cryptography and Network Security: Principles and Practice”, Pearson education, Fifth edition.

2. Bernard Menezes, “Network Security and Cryptography”, Cengage Learning, Second Edition.

3. Behrouz A Forouzan, Debdeep Mukhopadhyay, “Cryptography and Network Security”, Tata McGraw Hill, Second edition

4. Behrouz A. Forouzan, “Cryptography and Network Security”, Tata McGraw Hill.5. Charles P. Pfleeger, “Security in Computing”, Pearson Education.

62