0% found this document useful (0 votes)
19 views107 pages

UML Lab Manual for Cryptography

The document outlines a lab assignment on Network Security and Cryptography at Narasaraopeta Engineering College, detailing various programming tasks in C and Java. It includes aims to write programs for XOR and AND operations on strings, as well as implementing encryption and decryption algorithms like Caesar cipher, Substitution cipher, and Hill cipher. Each section provides code examples and explanations for the respective algorithms and their functionalities.

Uploaded by

vameli6349
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views107 pages

UML Lab Manual for Cryptography

The document outlines a lab assignment on Network Security and Cryptography at Narasaraopeta Engineering College, detailing various programming tasks in C and Java. It includes aims to write programs for XOR and AND operations on strings, as well as implementing encryption and decryption algorithms like Caesar cipher, Substitution cipher, and Hill cipher. Each section provides code examples and explanations for the respective algorithms and their functionalities.

Uploaded by

vameli6349
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

NETWORK SECURITY,

CRYPTOGRAPHY

Narasaraopeta Engineering College, Dept of MCA Page 1


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB
1. Aim: Write a C program that contains a string (char pointer) with a value “Hello World”.
The program should XOR each character in this string with 0 and displays the result.

#include <stdlib.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
Void main()
(
Clrscr()
Char str[]=”HelloWorld”;
Char str1 [11];
int I,len;
len=strlen(str);
for(i=0;i<len;i++)
{
Str1[i]=str[i]^0;
Printf(“%c”,str1[i]);
}
Printf(“\n”);
getch();
}
OUTPUT:

Narasaraopeta Engineering College, Dept of MCA Page 2


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB
2. Aim: Write a C program that contains a string (char pointer) with a value “Hello
World”.The program should AND or and XOR each character in this string with 127 and
displaysthe result.

#include <stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
Void main()
(
Clrscr()
Char str[]=”HelloWorld”;
Char str1 [11];
Char str2[11];
int I,len;
len=strlen(str);
for(i=0;i<len;i++)
{
Str1[i]=str[i]&127;
Printf(“%c”,str1[i]);
}
Printf(“\n”);
for(i=0;i<len;i++)
(
Str2[i]=str[i]^127;
}
Printf(“\n”);
getch();
}

OUTPUT:

Narasaraopeta Engineering College, Dept of MCA Page 3


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

3. Aim:- write a java program to perform encryption and decryption using the following
algorithms a. ceaser cipher b. substituaion cipher c. hill cipher

a) CAESAR CIPHER IN JAVA (ENCRYPTION AND DECRYPTION)

The Caesar cipher is a technique in which an encryption algorithm is used to change some text for
gaining integrity, confidentiality, or security of a message. In cryptography there are many algorithms
that are used to achieve the same, but Caesar cipher is the earliest and easiest algorithm used among
encryption techniques. This algorithm was named after Julius Caesar who was a Roman general and
statesman.

Aim: Write a Java program to perform encryption and decryption using Ceaser Cipher algorithm:
import [Link];

public class Solution {

// Define the alphabet


public static final String alpha = "abcdefghijklmnopqrstuvwxyz";

// Encrypt method
public static String encrypt(String message, int shiftKey) {
message = [Link](); // Ensure all letters are lowercase
StringBuilder cipherText = new StringBuilder();

// Loop through each character in the message


for (int ii = 0; ii < [Link](); ii++) {
char currentChar = [Link](ii);

// If the character is in the alphabet, encrypt it


if ([Link](currentChar) != -1) {
int charPosition = [Link](currentChar);
int keyVal = (shiftKey + charPosition) % 26; // Caesar cipher shift
char replaceVal = [Link](keyVal); // Get encrypted character
[Link](replaceVal); // Add to result
} else {
// If the character is not alphabetic (spaces, punctuation), add it as is
[Link](currentChar);
}
}
return [Link]();
}

public static void main(String[] args) {


Scanner sc = new Scanner([Link]);

// Get the input message


[Link]("Enter the string for encryption: ");
String message = [Link](); // Use nextLine to capture full string including spaces

Narasaraopeta Engineering College, Dept of MCA Page 4


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB
// Get the shift key
[Link]("Enter the shift key: ");
int key = [Link]();

// Encrypt and print the encrypted message


[Link]("Encrypted message: " + encrypt(message, key));

[Link](); // Close the scanner to prevent resource leak


}
}

OUTPUT:

DECRYPTION (BREAKING DOWN CAESAR CIPHER TO ORIGINAL


FORM
OUTPUT

B) Substitution Cipher [Encryption and Decryption]


Aim: The aim of this Java program is to demonstrate the implementation of a substitution cipher for
basic encryption and decryption of text.

import [Link];

public class SubstitutionCipher {


private static final String ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

Narasaraopeta Engineering College, Dept of MCA Page 5


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

// Method to encrypt the plaintext


public static String encrypt(String plaintext, String key) {
StringBuilder ciphertext = new StringBuilder();
plaintext = [Link]();

for (char ch : [Link]()) {


int index = [Link](ch);
if (index != -1) {
[Link]([Link](index));
} else {
[Link](ch); // Non-alphabet characters remain unchanged
}
}
return [Link]();
}

// Method to decrypt the ciphertext


public static String decrypt(String ciphertext, String key) {
StringBuilder plaintext = new StringBuilder();
ciphertext = [Link]();

for (char ch : [Link]()) {


int index = [Link](ch);
if (index != -1) {
[Link]([Link](index));
} else {
[Link](ch); // Non-alphabet characters remain unchanged
}
}
return [Link]();
}

public static void main(String[] args) {


Scanner scanner = new Scanner([Link]);

// Example substitution key (could be any random arrangement of the alphabet)


String key = "QWERTYUIOPASDFGHJKLZXCVBNM"; // Example key for substitution

[Link]("Enter plaintext to encrypt: ");


String plaintext = [Link]();

// Encrypt the plaintext


String encryptedText = encrypt(plaintext, key);
[Link]("Encrypted Text: " + encryptedText);

// Decrypt the ciphertext


String decryptedText = decrypt(encryptedText, key);
[Link]("Decrypted Text: " + decryptedText);

[Link]();

Narasaraopeta Engineering College, Dept of MCA Page 6


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

}
}

Output :
Enter plaintext to encrypt: HELLO
Encrypted Text: ITSSG
Decrypted Text: HELLO

C) Hill Cipher in Java [Encryption and Decryption]

In classical cryptography, the hill cipher is a polygraphic substitution cipher based on Linear
Algebra. It was invented by Lester S. Hill in the year 1929. In simple words, it is a cryptography
algorithm used to encrypt and decrypt data for the purpose of data security.

The algorithm uses matrix calculations used in Linear Algebra. It is easier to understand if we have
the basic knowledge of matrix multiplication, modulo calculation, and the inverse calculation of
matrices.

In hill cipher algorithm every letter (A-Z) is represented by a number moduli 26. Usually, the simple
substitution scheme is used where A = 0, B = 1, C = 2…Z = 25 in order to use 2x2 key matrix.
Aim: Write a Java program to perform encryption and decryption using Hill Cipher algorithm:
import [Link].*;
import [Link];
import [Link];
import [Link];
public class HillCipherExample {
int[] lm;
int[][] km;
int[] rm;
static int choice;
int [][] invK;

public void performDivision(String temp, int s)


{
while ([Link]() > s)
{

Narasaraopeta Engineering College, Dept of MCA Page 7


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

String line = [Link](0, s);


temp = [Link](s, [Link]());
calLineMatrix(line);
if(choice ==1){
multiplyLineByKey([Link]());
}else{
multiplyLineByInvKey([Link]());
}
showResult([Link]());
}
if ([Link]() == s){

if(choice ==1){
calLineMatrix(temp);
multiplyLineByKey([Link]());
showResult([Link]());
}
else{
calLineMatrix(temp);
[Link]([Link]());
showResult([Link]());
}
}
else if ([Link]() < s)
{
for (int i = [Link](); i < s; i++)
temp = temp + 'x';
if(choice ==1){
calLineMatrix(temp);
multiplyLineByKey([Link]());
showResult([Link]());
}
else{
calLineMatrix(temp);
multiplyLineByInvKey([Link]());
showResult([Link]());
}
}
}
public void calKeyMatrix(String key, int len)
{
km = new int[len][len];
int k = 0;
for (int i = 0; i < len; i++)
{
for (int j = 0; j < len; j++)
{
km[i][j] = ((int) [Link](k)) - 97;
k++;
}

Narasaraopeta Engineering College, Dept of MCA Page 8


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

}
}
public void calLineMatrix(String line)
{
lm = new int[[Link]()];
for (int i = 0; i < [Link](); i++)
{
lm[i] = ((int) [Link](i)) - 97;
}
}
public void multiplyLineByKey(int len)
{
rm = new int[len];
for (int i = 0; i < len; i++)
{
for (int j = 0; j < len; j++)
{
rm[i] += km[i][j] * lm[j];
}
rm[i] %= 26;
}
}
public void multiplyLineByInvKey(int len)
{

rm = new int[len];
for (int i = 0; i < len; i++)
{
for (int j = 0; j < len; j++)
{
rm[i] += invK[i][j] * lm[j];
}
rm[i] %= 26;
}
}

public void showResult(int len)


{
String result = "";
for (int i = 0; i < len; i++)
{
result += (char) (rm[i] + 97);
}
[Link](result);
}

public int calDeterminant(int A[][], int N)


{
int resultOfDet;
switch (N) {

Narasaraopeta Engineering College, Dept of MCA Page 9


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

case 1:
resultOfDet = A[0][0];
break;
case 2:
resultOfDet = A[0][0] * A[1][1] - A[1][0] * A[0][1];
break;
default:
resultOfDet = 0;
for (int j1 = 0; j1 < N; j1++)
{
int m[][] = new int[N - 1][N - 1];
for (int i = 1; i < N; i++)
{
int j2 = 0;
for (int j = 0; j < N; j++)
{
if (j == j1)
continue;
m[i - 1][j2] = A[i][j];
j2++;
}
}
resultOfDet += [Link](-1.0, 1.0 + j1 + 1.0) * A[0][j1]
* calDeterminant(m, N - 1);
} break;
}
return resultOfDet;
}
public void cofact(int num[][], int f)
{
int b[][], fac[][];
b = new int[f][f];
fac = new int[f][f];
int p, q, m, n, i, j;
for (q = 0; q < f; q++)
{
for (p = 0; p < f; p++)
{
m = 0;
n = 0;
for (i = 0; i < f; i++)
{
for (j = 0; j < f; j++)
{
b[i][j] = 0;
if (i != q && j != p)
{
b[m][n] = num[i][j];
if (n < (f - 2))
n++;

Narasaraopeta Engineering College, Dept of MCA Page 10


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

else
{
n = 0;
m++;
}
}
}
}
fac[q][p] = (int) [Link](-1, q + p) * calDeterminant(b, f - 1);
}
}
trans(fac, f);
}
void trans(int fac[][], int r)
{
int i, j;
int b[][], inv[][];
b = new int[r][r];
inv = new int[r][r];
int d = calDeterminant(km, r);
int mi = mi(d % 26);
mi %= 26;
if (mi < 0)
mi += 26;
for (i = 0; i < r; i++)
{
for (j = 0; j < r; j++)
{
b[i][j] = fac[j][i];
}
}
for (i = 0; i < r; i++)
{
for (j = 0; j < r; j++)
{
inv[i][j] = b[i][j] % 26;
if (inv[i][j] < 0)
inv[i][j] += 26;
inv[i][j] *= mi;
inv[i][j] %= 26;
}
}
//[Link]("\nInverse key:");
//matrixtoinvkey(inv, r);

invK = inv;
}
public int mi(int d)
{
int q, r1, r2, r, t1, t2, t;

Narasaraopeta Engineering College, Dept of MCA Page 11


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

r1 = 26;
r2 = d;
t1 = 0;
t2 = 1;
while (r1 != 1 && r2 != 0)
{
q = r1 / r2;
r = r1 % r2;
t = t1 - (t2 * q);
r1 = r2;
r2 = r;
t1 = t2;
t2 = t;
}
return (t1 + t2);
}
public void matrixtoinvkey(int inv[][], int n)
{
String invkey = "";
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
invkey += (char) (inv[i][j] + 97);
}
}
[Link](invkey);
}
public boolean check(String key, int len)
{
calKeyMatrix(key, len);
int d = calDeterminant(km, len);
d = d % 26;
if (d == 0)
{
[Link]("Key is not invertible");
return false;
}
else if (d % 2 == 0 || d % 13 == 0)
{
[Link]("Key is not invertible");
return false;
}
else
{
return true;
}
}
public static void main(String args[]) throws IOException
{

Narasaraopeta Engineering College, Dept of MCA Page 12


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB
HillCipherExample obj = new HillCipherExample();
BufferedReader in = new BufferedReader(new InputStreamReader([Link]));
[Link]("Menu:\n1: Encryption\n2: Decryption");
choice = [Link]([Link]());
[Link]("Enter the line: ");
String line = [Link]();
[Link]("Enter the key: ");
String key = [Link]();
double sq = [Link]([Link]());
if (sq != (long) sq)
[Link]("Cannot Form a square matrix");
else
{
int size = (int) sq;
if ([Link](key, size))
{

[Link]("Result:");
[Link]([Link], size);
[Link](line, size);

}
}
}
}

OUTPUT
Menu:
1: Encryption
2: Decryption
1
Enter the line:
helloworld
Enter the key:
mble
Result:
kpnjiidofd
Menu:
1: Encryption
2: Decryption
2
Enter the line:
kpnjiidofd
Enter the key:
mble
Result:
helloworld

Narasaraopeta Engineering College, Dept of MCA Page 13


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

4. Write a c/java program to implement the DES algorithm logic.

Data Encryption Standard (DES) Algorithm


Data Encryption Standard is a symmetric-key algorithm for the encrypting the data. It comes under
block cipher algorithm which follows Feistel structure. Here is the block diagram of Data Encryption
Standard.

Aim: Write a Java program to implement the DES algorithm logic.

import [Link].*;
import [Link]; import
[Link]; import
[Link]; import
[Link];
import [Link];

import [Link]; import


[Link]; import
[Link].BASE64Decoder;
import [Link].BASE64Encoder;

public class DES{


private static final String UNICODE_FORMAT = "UTF8";

public static final String DESEDE_ENCRYPTION_SCHEME = "DESede";


privateKeySpecmyKeySpec; privateSecretKeyFactorymySecretKeyFactory;
private Cipher cipher;
byte[] keyAsBytes;

private String myEncryptionKey; private


String myEncryptionScheme; SecretKey
key;

static BufferedReader br = new BufferedReader(new


InputStreamReader([Link])); public DES() throws Exception {
// TODO code application logic here myEncryptionKey
= "ThisIsSecretEncryptionKey"; myEncryptionScheme =
Narasaraopeta Engineering College, Dept of MCA Page 14
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

DESEDE_ENCRYPTION_SCHEME; keyAsBytes =

[Link](UNICODE_FORMAT); myKeySpec

= new DESedeKeySpec(keyAsBytes);
mySecretKeyFactory = [Link](myEncryptionScheme); cipher
= [Link](myEncryptionScheme);
key = [Link](myKeySpec);
}
publicString encrypt(String unencryptedString)

{ String encryptedString = null;


try {
[Link](Cipher.ENCRYPT_MODE, key);

byte[] plainText = [Link](UNICODE_FORMAT); byte[]


encryptedText = [Link](plainText);
BASE64Encoder base64encoder = new BASE64Encoder(); encryptedString

= [Link](encryptedText); }
catch (Exception e)
{ [Link](); }

returnencryptedString; }
publicString decrypt(String encryptedString)

{ String decryptedText=null;

try {
[Link](Cipher.DECRYPT_MODE, key);

BASE64Decoder base64decoder = new BASE64Decoder(); byte[]


encryptedText = [Link](encryptedString); byte[]

plainText = [Link](encryptedText); decryptedText=


bytes2String(plainText); }

catch (Exception e)

Narasaraopeta Engineering College, Dept of MCA Page 15


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

private static String bytes2String(byte[] bytes)


{ StringBufferstringBuffer = new StringBuffer();

for (int i = 0; i <[Link];

i++) { [Link]((char) bytes[i]); }


[Link](); }
public static void main(String args []) throws Exception

{ [Link]("Enter the string:");DES


myEncryptor= newDES();
String stringToEncrypt = [Link]();

String encrypted = [Link](stringToEncrypt); String


decrypted = [Link](encrypted);
[Link]("\nString To Encrypt: " +stringToEncrypt);
[Link]("\nEncrypted Value : " +encrypted);
[Link]("\nDecrypted Value : " +decrypted); [Link]("");

OUTPUT:
Enter the string: Welcome String

To Encrypt:Welcome
Encrypted Value : BPQMwc0wKvg=

Decrypted Value : Welcome

Narasaraopeta Engineering College, Dept of MCA Page 16


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

5. Write a java program to implement RSA algorithm


RSA Algorithm
Aim: Write a Java program to implement RSA algoithm.
import [Link].*;
import [Link].*;
public class rsa
{ static int gcd(int m,int n)
{ while(n!=0)
{ int r=m%n;
m=n;
n=r;
}
return m;
}
public static void main(String args[])
{
int p=0,q=0,n=0,e=0,d=0,phi=0;
int nummes[]=new int[100];
int encrypted[]=new int[100];
int decrypted[]=new int[100];
int i=0,j=0,nofelem=0;
Scanner sc=new Scanner([Link]);
String message ;
[Link]("Enter the Message tobe encrypted:");
message= [Link]();
[Link]("Enter value of p and q\n");
p=[Link]();
q=[Link]();
n=p*q;
phi=(p-1)*(q-1);
for(i=2;i<phi;i++)
if(gcd(i,phi)==1) break;
e=i;
for(i=2;i<phi;i++)
if((e*i-1)%phi==0)
break;
d=i;
for(i=0;i<[Link]();i++)
{
char c = [Link](i);
int a =(int)c;
nummes[i]=c-96;
}
nofelem=[Link]();
for(i=0;i<nofelem;i++)
{
encrypted[i]=1;
for(j=0;j<e;j++)
encrypted[i] =(encrypted[i]*nummes[i])%n;
}

Narasaraopeta Engineering College, Dept of MCA Page 17


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB
[Link]("\n Encrypted message\n");
for(i=0;i<nofelem;i++)
{
[Link](encrypted[i]);
[Link]((char)(encrypted[i]+96));
}
for(i=0;i<nofelem;i++)
{ decrypted[i]=1;
for(j=0;j<d;j++)

decrypted[i]=(decrypted[i]*encrypted[i])%n;
}
[Link]("\n Decrypted message\n ");
for(i=0;i<nofelem;i++)
[Link]((char)(decrypted[i]+96));
return;
}
}

OUTPUT:
Enter the text:
hello
Enter the value of P and Q :
5
7
Encrypted Text is: 8 h 10 j 17 q 17 q 15 o
Decrypted Text is: hello

Narasaraopeta Engineering College, Dept of MCA Page 18


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

UML

Narasaraopeta Engineering College, Dept of MCA Page 23


NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

EXPERIMENT-1
BANKING SYSTEM

37
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with use case diagram for Bank application


use case diagram: A use case diagram is a graphic depiction of the interactions among the
elements of a system.
A use case is a methodology used in system analysis to identify, clarify, and organize system
requirements
The actors, usually individuals involved with the systemdefined according to their roles.

Description:
In a Banking System bank maintains different branches in different areas. In each branch the
customer can open account. It may be savings/checking account. The customer can make
transaction like deposit, withdraw or he can apply loan. Bank maintains branches information
and each branch maintains its customers and employees details.

Identified Actors:

1. Bank

2. Manager

3. Bank Database

4. Loans

5. Customer

Result: We have successfully worked with Bank Application.

38
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

39
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with class diagram for bank application.

Class Diagram:
Class diagram in theUnified Modeling Language (UML) is a type of static structure
diagram that describes the structure of a system by showing the system's classes, their
attributes, operations (or methods), and the relationships among objects.

40
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with object diagram for bank application.

Object Diagram: Object diagram in the Unified Modeling Language (UML), is


a diagram that shows a complete or partial view of the structure of a modeled system at a
specific time.

41
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim:
To work with sequence diagram for bank application.

Sequence Diagram: A sequence diagram shows object interactions arranged in time


sequence. It depicts the objects and classes involved in the scenario and the sequence of
messages exchanged between the objects needed to carry out the functionality of the scenario.

42
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Collaboration Diagram:

Collaboration diagram is used to model how objects involved in a scenario interact,


with each object instantiating a particular class in the system. Objects are connected by links,
each link representing an instance of an association between the respective classes involved.
The link shows messages sent between the objects, and the type of message passed.

In general Sequence and collaboration diagrams are Interaction models but with
different Representations.

In Star Uml V2 Conversion to sequence to collaboration diagram is not supported


So latest version of Staruml is V2.8.0 is also not supported to draw Collaboration diagram.
So one representation style i.e Sequence diagram is used to draw Interaction Models.

43
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the activity diagram without swim-lane for bank

application.

Activity Diagram: Activity diagrams are graphical representations of workflows of


stepwise activities and actions with support for choice, iteration and concurrency.

44
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the activity diagram with swim-lane for bank application.

45
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim:To work with the State chart diagram for bank

State Diagram: A state diagram, also called a state machine diagramor statechart diagram,
is an illustration of the states an object can attain as well as the transitions between those
states in the Unified Modeling Language (UML).

46
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the component diagram for bank application.

Component Diagram: A component is a container of logical elements and represents


things that participate in the execution of a system

47
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the deployment diagram for bank application.

Deployment Diagram : Deployment diagram is a structure diagram which shows


architecture of the system as deployment(distribution) of software artifacts to deployment
targets.

48
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

EXPERIMENT-2

ATM SYSTEM

49
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the use case diagram for atm system.

use case diagram: A use case diagram is a graphic depiction of the interactions among the
elements of a system.
A use case is a methodology used in system analysis to identify, clarify, and organize system
requirements
The actors, usually individuals involved with the systemdefined according to their roles.

Description:

A bank has several automated teller machines(ATMs),which are geographically


distributed and connected via a wide area network to a central sever. Each ATM machine has
a card reader, a cash dispenser, a keyboard/display, and a receipt printer. By using the ATM
machine, a customer can withdraw cash from either a checking or savings account; query the
balance of an account, or transfer funds from one account to another. Assuming the card is
recognized, the system validates the ATM card to determine that the expiration date has not
passed, that the user-entered PIN (Personal Identification Number) matches the PIN maintained
by the system ,and that the card is not lost or stolen. The customer is allowed three attempts to
enter the correct PIN: The card is confiscated if the third attempt fails. Cards that have been
reported lost or stolen are also confiscated.

If the PIN is validated satisfactorily, the customer is prompted for a withdrawal, query,
or transfer transaction .Before a withdrawal a transaction can be approved, the system,
determines that sufficient funds exist in the requested account, that the maximum daily limit
will not be exceeded, and that there are sufficient funds at the local cash dispenser. If the
transaction is approved the requested amount of cash is dispensed, a receipt is printed
containing information about the transaction, and the card is rejected..

50
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Identified Classes:

1. ATM
2. Customer
3. Administrator
4. Database

51
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the class diagram for atm system.

Class Diagram:
Class diagram in theUnified Modeling Language (UML) is a type of static structure
diagram that describes the structure of a system by showing the system's classes, their
attributes, operations (or methods), and the relationships among objects.

52
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the object diagram for atm system.

Object Diagram: Object diagram in the Unified Modeling Language (UML), is


a diagram that shows a complete or partial view of the structure of a modeled system at a
specific time.

53
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the sequence diagram for atm system.

Sequence Diagram: A sequence diagram shows object interactions arranged in time


sequence. It depicts the objects and classes involved in the scenario and the sequence of
messages exchanged between the objects needed to carry out the functionality of the scenario.

54
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the activity diagram without swim-lane for atm system.

Activity Diagram: Activity diagrams are graphical representations of workflows of


stepwise activities and actions with support for choice, iteration and concurrency.

55
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the activity diagram with swim-lane for atm system.

56
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the statechart diagram for atm system

State Diagram: A state diagram, also called a state machine diagramor statechart diagram,
is an illustration of the states an object can attain as well as the transitions between those
states in the Unified Modeling Language (UML).

57
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with component diagram for atm system.

Component Diagram: A component is a container of logical elements and represents


things that participate in the execution of a system

58
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work deployment diagram for atm system.

Deployment Diagram : Deployment diagram is a structure diagram which shows


architecture of the system as deployment(distribution) of software artifacts to deployment
targets.

59
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

EXPERIMENT-3

ONLINE AUCTION SYSTEM

60
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with use case diagram for online auction system.

use case diagram: A use case diagram is a graphic depiction of the interactions among the
elements of a system.
A use case is a methodology used in system analysis to identify, clarify, and organize system
requirements
The actors, usually individuals involved with the systemdefined according to their roles.

Description:

Several commerce models exist and are the basis for a number of companies like eBay,
com, price line, com, etc., Design and implement an auction application that provides
auctioning services. It should clearly model the various auctioneers, the bidding process,
auctioning etc. Due to some circumstances some crop field is brought into the auction. The
auctioneers know about the auction and come to the specified location on the particular date.
Auction application should be designed and implemented. The application should include
various auctioneers, bidding process, auctioning etc. Banks are also involved in the auction
process for helping the organizations in the matter of transactions.

Identified Classes:

1. Customer

2. Vendor

3. Administrator

4. Products

61
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

62
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with class diagram for online auction system.

Class Diagram:
Class diagram in theUnified Modeling Language (UML) is a type of static structure
diagram that describes the structure of a system by showing the system's classes, their
attributes, operations (or methods), and the relationships among objects.

63
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the object diagram with for online auction system.

Object Diagram: Object diagram in the Unified Modeling Language (UML), is


a diagram that shows a complete or partial view of the structure of a modeled system at a
specific time.

64
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the sequence diagram for online auction system.

Sequence Diagram: A sequence diagram shows object interactions arranged in time


sequence. It depicts the objects and classes involved in the scenario and the sequence of
messages exchanged between the objects needed to carry out the functionality of the scenario.

65
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the activity diagram without swim-lane for

online auction system.

Activity Diagram: Activity diagrams are graphical representations of workflows of


stepwise activities and actions with support for choice, iteration and concurrency.

66
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the activity diagram with swim-lane for online auction

system.

67
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the state chart diagram with for online auction system.

State Diagram: A state diagram, also called a state machine diagramor statechart diagram,
is an illustration of the states an object can attain as well as the transitions between those
states in the Unified Modeling Language (UML).

68
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the component diagram with for online auction system.

Component Diagram: A component is a container of logical elements and represents


things that participate in the execution of a system

69
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the deployment diagram with for online auction system.

Deployment Diagram : Deployment diagram is a structure diagram which shows


architecture of the system as deployment(distribution) of software artifacts to deployment
targets.

70
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

EXPERIMENT-4

RAILWAY RESERVATION SYSTEM

71
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the use case diagram with for railway reservation system.

use case diagram: A use case diagram is a graphic depiction of the interactions among the
elements of a system.
A use case is a methodology used in system analysis to identify, clarify, and organize system
requirements
The actors, usually individuals involved with the systemdefined according to their roles.

72
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Description :

The Indian Railways (IR) carries about thousand of lakes passengers in reserved
accommodation every day. The Computerized Passenger Reservation System (PRS) facilities
the booking and cancellation of tickets from any of the approximately lakes of terminals (i.e.
PRS book-in window all over the countries). These tickets can be booked or cancelled for
journeys commencing in any part of India and ending in any other part, with travel time as long
as 72 hours and distance up to several thousand kilometers. The project of PRS was launched
on 15th November 1985, over Northern Railway with the installation of Integrated Multiple
Train Passenger Reservation System (IMPRESS), an online transaction processing system
developed by Indian Railways in association with Computer Maintenance Corporation Ltd., at
New Delhi. The objective was to provide reserved accommodations on any train from any
counter, preparation of train charts and accounting of the money collected.

METHODS:

ONLINE BOOKING:
With the help of this people can book their tickets online through internet, sitting in
their home by a single click of mouse. Using their credit cards people can easily get their tickets
done within minutes. There are certain charges for online booking as well.

COUNTER BOOKING:
This is the oldest method of booking the tickets. The reservation counters are there at
railway department from where people can get the tickets to their respective destinations.

73
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the class diagram for railway reservation system.

Class Diagram:
Class diagram in theUnified Modeling Language (UML) is a type of static structure
diagram that describes the structure of a system by showing the system's classes, their
attributes, operations (or methods), and the relationships among objects.

74
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the object diagram for railway reservation system.

Object Diagram: Object diagram in the Unified Modeling Language (UML), is


a diagram that shows a complete or partial view of the structure of a modeled system at a
specific time.

75
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the sequence diagram for railway reservation system.

Sequence Diagram: A sequence diagram shows object interactions arranged in time


sequence. It depicts the objects and classes involved in the scenario and the sequence of
messages exchanged between the objects needed to carry out the functionality of the scenario.

76
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the activity diagram without swim-lane for railway

reservation system.

Activity Diagram: Activity diagrams are graphical representations of workflows of


stepwise activities and actions with support for choice, iteration and concurrency.

77
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the activity diagram with swim-lane for railway

reservation system.

78
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the state chart diagram for railway reservation system.

State Diagram: A state diagram, also called a state machine diagramor statechart diagram,
is an illustration of the states an object can attain as well as the transitions between those
states in the Unified Modeling Language (UML).

79
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the component diagram for railway reservation system.

Component Diagram: A component is a container of logical elements and represents


things that participate in the execution of a system

80
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the deployment diagram for railway reservation system.

Deployment Diagram : Deployment diagram is a structure diagram which shows


architecture of the system as deployment(distribution) of software artifacts to deployment
targets.

81
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

EXPERIMENT-5

SENDING SECURE FILE BY USING

CRYPTOGRAPHY

82
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the use case diagram for sending secure file by using cryptography.

use case diagram: A use case diagram is a graphic depiction of the interactions among the
elements of a system.
A use case is a methodology used in system analysis to identify, clarify, and organize system
requirements
The actors, usually individuals involved with the systemdefined according to their roles.

Description:

The art of protecting information by transforming it (encrypting it) into an unreadable


format, called cipher text. Only those who possess a secret key can decipher (or decrypt) the
message into plain text. Encrypted messages can sometimes be broken by cryptanalysis, also
called codebreaking, although modern cryptography techniques are virtually unbreakable.

As the Internet and other forms of electronic communication become more prevalent,
electronic security is becoming increasingly important. Cryptography is used to protect e- mail
messages, credit card information, and corporate data. One of the most popular cryptography
systems used on the Internet is Pretty Good Privacy because it's effective and free.

Cryptography systems can be broadly classified into symmetric-key systems that use a single
key that both the sender and recipient have, and public-key systems that use two keys, a public
key known to everyone and a private key that only the recipient of messages uses.

Identified Classes:

1. Sender

2. Receiver

83
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

84
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the class diagram for sending secure file by using cryptography.

Class Diagram:
Class diagram in theUnified Modeling Language (UML) is a type of static structure
diagram that describes the structure of a system by showing the system's classes, their
attributes, operations (or methods), and the relationships among objects.

85
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the object diagram for sending secure file by using cryptography.

Object Diagram: Object diagram in the Unified Modeling Language (UML), is


a diagram that shows a complete or partial view of the structure of a modeled system at a
specific time.

86
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the sequence diagram for sending secure file by using cryptography.

Sequence Diagram: A sequence diagram shows object interactions arranged in time


sequence. It depicts the objects and classes involved in the scenario and the sequence of
messages exchanged between the objects needed to carry out the functionality of the scenario.

87
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the activity diagram for sending secure file by using cryptography.

Activity Diagram: Activity diagrams are graphical representations of workflows of


stepwise activities and actions with support for choice, iteration and concurrency.

88
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the state chart diagram for sending secure file by using cryptography.

State Diagram: A state diagram, also called a state machine diagram or statechart diagram,
is an illustration of the states an object can attain as well as the transitions between those
states in the Unified Modeling Language (UML).

89
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the component diagram for sending secure file by using cryptography.

Component Diagram: A component is a container of logical elements and represents


things that participate in the execution of a system

90
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the deployment diagram for sending secure file by using cryptography.

Deployment Diagram : Deployment diagram is a structure diagram which shows


architecture of the system as deployment(distribution) of software artifacts to deployment
targets.

91
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

EXPERIMENT-6

LIBRARY SYSTEM

92
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the use case diagram for library system.

use case diagram: A use case diagram is a graphic depiction of the interactions among the
elements of a system.
A use case is a methodology used in system analysis to identify, clarify, and organize system
requirements
The actors, usually individuals involved with the systemdefined according to their roles.

Description:

A college library is filled with books, periodicals, journals and magazines. It also has
audio and video cassettes as well as CD ROM’s. The library leads its items to bonfire
members.

Membership of the college library is restricted to staff an student of the college.


They
are issued with membership cards which contain a unique id. The library purchasing and adding
items to it inventory in data base users of the library are the librarian and the barrowers. The
library is in needs of a web application which automates the functions of the library. It must
have the capability to allow members to browse, search, barrow items, and also support systems
to manage inventory and the members. The system must contain a database comprising of:
Title and items in its inventory. Since libraries have multiple copies of popular books,
magazines, the title name of book and the author must be stored separately and the physical
number of these titles stored separately as an item.

Identified Classes:

1. Librarian
2. Member
3. Student
4. Professor
5. Supplier

93
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

94
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the class diagram for library system.

Class Diagram:
Class diagram in theUnified Modeling Language (UML) is a type of static structure
diagram that describes the structure of a system by showing the system's classes, their
attributes, operations (or methods), and the relationships among objects.

95
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the object diagram for library system.

Object Diagram: Object diagram in the Unified Modeling Language (UML), is


a diagram that shows a complete or partial view of the structure of a modeled system at a
specific time.

96
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the sequence diagram for library system.

Sequence Diagram: A sequence diagram shows object interactions arranged in time


sequence. It depicts the objects and classes involved in the scenario and the sequence of
messages exchanged between the objects needed to carry out the functionality of the scenario.

97
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the activity diagram without swim-lane for library system.

Activity Diagram: Activity diagrams are graphical representations of workflows of


stepwise activities and actions with support for choice, iteration and concurrency.

98
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the activity diagram with swim-lane for library system.

99
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the state chart diagram for library system

State Diagram: A state diagram, also called a state machine diagramor statechart diagram,
is an illustration of the states an object can attain as well as the transitions between those
states in the Unified Modeling Language (UML).

100
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the component diagram for library system.

Component Diagram: A component is a container of logical elements and represents


things that participate in the execution of a system

101
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the deployment diagram for library system.

Deployment Diagram : Deployment diagram is a structure diagram which shows


architecture of the system as deployment(distribution) of software artifacts to deployment
targets.

102
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

EXPERIMENT-7

UNIVERSITY MANAGEMENT SYSTEM

103
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the use case diagram for university management system.

use case diagram: A use case diagram is a graphic depiction of the interactions among the
elements of a system.
A use case is a methodology used in system analysis to identify, clarify, and organize system
requirements
The actors, usually individuals involved with the systemdefined according to their roles.

Description:

In a university registration system student login and view the set of colleges and select
the desired college .He joins that college and learns desired course by filling application.
College maintains several departments and each department has both teaching and non teaching
staff. The college conduct interview and conduct admissions, university maintains college’s
information.

Identified Classes:

1. University
2. Colleges
3. Student
4. Professor

104
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

105
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the class diagram for university management system.

Class Diagram:
Class diagram in theUnified Modeling Language (UML) is a type of static structure
diagram that describes the structure of a system by showing the system's classes, their
attributes, operations (or methods), and the relationships among objects.

106
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the object diagram for university management system.

Object Diagram: Object diagram in the Unified Modeling Language (UML), is


a diagram that shows a complete or partial view of the structure of a modeled system at a
specific time.

107
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the sequence diagram for university management system.

Sequence Diagram: A sequence diagram shows object interactions arranged in time


sequence. It depicts the objects and classes involved in the scenario and the sequence of
messages exchanged between the objects needed to carry out the functionality of the scenario.

108
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the activity diagram without swim-lane for university management system.

Activity Diagram: Activity diagrams are graphical representations of workflows of


stepwise activities and actions with support for choice, iteration and concurrency.

109
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the activity diagram with swim-lane for university management system.

110
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the state chart diagram for university management system.

State Diagram: A state diagram, also called a state machine diagramor statechart diagram,
is an illustration of the states an object can attain as well as the transitions between those
states in the Unified Modeling Language (UML).

111
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the component diagram for university management system.

Component Diagram: A component is a container of logical elements and represents


things that participate in the execution of a system

112
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the deployment diagram for university management system.

Deployment Diagram : Deployment diagram is a structure diagram which shows


architecture of the system as deployment(distribution) of software artifacts to deployment
targets.

113
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

EXPERIMENT-8

HOSPITALITY SYSTEM

114
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the use case diagram for hospitality system.

use case diagram: A use case diagram is a graphic depiction of the interactions among the
elements of a system.
A use case is a methodology used in system analysis to identify, clarify, and organize system
requirements
The actors, usually individuals involved with the systemdefined according to their roles.

Description:

This Hospital Inventory system manages patient info, staff info, stores and medicines,
billing and report generation. This complex application communicates with a backend
database server and manages all information related to Hospital logistics.

Hospital Information Systems provide a common source of information about a patient’s


health history. The system has to keep data in a secure place and controls who can reach the
data in certain circumstances. These systems enhance the ability of health care professionals
to coordinate care by providing a patient’s health information and visit history at the place
and time that it is needed. Patient’s laboratory test information also includes visual results
such as X-ray, which may be reachable by professionals. HIS provide internal and external
communication among health care providers.
The HIS may control organizations (a Hospital in this case), official documentations,
financial situation reports, personal data, utilities and stock amounts. The HIS also keeps in a
secure place: patients' information, patients' medical history, prescriptions, operations and
laboratory test results.
The HIS may protect organizations, handwriting errors, overstock problems, conflict of
scheduling personnel, and official documentation errors like tax preparations errors.

Contents
1. Patient
2. Doctor
3. Nurse
4. Receptionist

115
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

116
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the class diagram for hospitality system.

Class Diagram:
Class diagram in theUnified Modeling Language (UML) is a type of static structure
diagram that describes the structure of a system by showing the system's classes, their
attributes, operations (or methods), and the relationships among objects.

117
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the object diagram for hospitality system.

Object Diagram: Object diagram in the Unified Modeling Language (UML), is


a diagram that shows a complete or partial view of the structure of a modeled system at a
specific time.

118
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the sequence diagram for hospitality system.

Sequence Diagram: A sequence diagram shows object interactions arranged in time


sequence. It depicts the objects and classes involved in the scenario and the sequence of
messages exchanged between the objects needed to carry out the functionality of the scenario.

119
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the activity diagram without swim-lane for hospitality system.

Activity Diagram: Activity diagrams are graphical representations of workflows of


stepwise activities and actions with support for choice, iteration and concurrency.

120
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the activity diagram with swim-lane for hospitality system.

121
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the state chart diagram for hospitality system.

State Diagram: A state diagram, also called a state machine diagramor statechart diagram,
is an illustration of the states an object can attain as well as the transitions between those
states in the Unified Modeling Language (UML).

122
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the component diagram for hospitality system.

Component Diagram: A component is a container of logical elements and represents


things that participate in the execution of a system

123
NETWORK SECURITY, CRYPTOGRAPHY & UML LAB

Aim: To work with the deployment diagram for hospitality system.

Deployment Diagram : Deployment diagram is a structure diagram which shows


architecture of the system as deployment(distribution) of software artifacts to deployment
targets.

124

You might also like