CPT 341 VB.NET Project 2 – Symmetric Key Encryption VB. Topics: Simple Encryptio
ID: 3576581 • Letter: C
Question
CPT 341 VB.NET Project 2 – Symmetric Key Encryption
VB. Topics: Simple Encryption/Decryption, Multiple Forms, String Manipulation & Conversion, File I/O, Readline, WriteLine, Sequential Text File, ASCII Character Set, OpenFileDialog, SaveFileDialog, PasswordChar, Form.Show , Me.Hide, Chr(), Asc(), Chr(), Mod Operator
Develop a Visual Basic Windows Forms application using 3 VB Forms that will ‘encrypt’ (character shift) the characters in a string based on a password (symmetric key) and store the cipher-text in a text file. The application must also open (‘decrypt’) the message only using the password that was used to encrypt the message.
Form 1 – Enter a message in the “Enter Text to Encrypt” TextBox control. Use Textbox controls to either encrypt or decrypt a message. A separate VB Form should be used for the encryption/decryption events.
Password Form – Enter a password (and again to confirm the password) to be used to convert the clear-text message to cipher-text. The cipher-text will need to written to a sequential text-file. Use a SaverFileDialog control to save the cipher-text message.
Decrypt Form – Use the password (used to create the cipher-text) to decrypt the cipher-text stored in the sequential text file. To locate the file containing the cipher-text, use an OpenFileDialog control.
Notes
Use File.IO to read and write text files
Passwords will need to be converted to numbers before storing each value in an array
Since there are a limited number of digits in a key, your program must ‘wrap-back’ to the first digit
The numeric equivalent of the password must be stored in an array
The resulting cipher-text output is to be stored in a text file
Using the same password for encryption and decryption Since only printable characters are used (see table), if the ASCII code becomes larger than 126, you will need to wrap around to the ASCII code 32 (space)
Use exception handling where needed…for example, FileNotFound or DirectoryNotFound.
‘Shifting Characters’ Example: Using a sample password = “Pwdabc”, the numeric equivalent of each character is equal to 80119100979899
a File Content Encryption Enter Text to Encrypt Ale aeartext Encrypt Form 1 DecryptExplanation / Answer
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef DICE_H
#define DICE_H
class Dice
;
#endif
Here is that the ccp file for dice.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include<cstdlib>
#include<ctime>
#include "Dice.h"
using namespace std;
Dice::Dice(int numSides)
unsigned seed = time (0);
srand(seed);
sides = numSides;
roll();
}
void Dice::roll()
worth = (rand() the troubles (sides - MIN_VALUE +1 ))+MIN_VALUE;
}
int Dice::getSides()
int Dice::getValue()
and finally here is my ASCII text file cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#include<iostream>
#include"Dice.h"
#include<string>
using namespace std;
int main()