Welcome to the next mini project.
And over here,
we're gonna build ourselves a tool for encrypting and decrypting files.
Now, the way it works is that once the user has run the program,
they will be provided with four different options.
You can see on your screen,
they can either generate an encryption key, encrypt, the file,
decrypt the file or simply just exit the program.
So if I go with option number one right here to generate an encryption key,
now you can see that we're gonna be prompted with the question,
enter the file path to save the key.
Now, the point of this is that we're actually going to provide the user the ability
to either use the default key that we ourselves are gonna create or
they could use their own custom key.
That's the whole point of this question or prompt,
asking the user to provide the file path.
So if the user decides to go with the default key,
so I'm going to press enter right now.
Now you will see that we've created a file over here called encryption
on the score key key that now has a particular key for encryption
So now if I was to go back to the program and I typed option number two to encrypt a file,
I have created a sample
XI
file in here with some random text.
So let's say for example, we wanted to encrypt this file. Now
I'm going to provide the name of the file, sample dot
txt
press enter.
And now we can provide a name for the output file.
So we can call this one encrypted underscore file dot TXT. OK?
And now we press enter
and now we can enter the path of the encryption key to be used
again. We're gonna go with the default key. So I'll press enter
and now our file has been encrypted
and has been saved to another file called encrypted underscore file dot TXT.
You can see this is the file right here. So
if I open it up right now,
you can see that this is the encrypted version of our sample dot txt file.
Now, if I go back and go with option number three to decrypt a file,
OK? And now let us decrypt
the file that we just encrypted.
OK. So
I'm gonna go encrypted
underscore file dot TXT.
This is the file that we just, this is the newly encrypted file. So now I press enter
and now what's the name of the upload file? We can see decrypted underscore file
dot TXT. We press enter and then we press enter again to use the default key.
And now we have decrypted the file and send it
to a new file called decrypted underscore file dot TXT.
And if I open it right here
now, you can see we have gotten the exact same text back again.
So basically the, the way the program works is that we're gonna provide
a
file in this case right now, it is going to be sampled dot TXT.
We're going to encrypt it using the encryption key that we've generated.
We're gonna store it to a file called encrypted
uncore file dot TXT.
And then we're going to attempt to decrypt
the file and then save the contents to decrypted
domos
file dot XT. And as you can see right now, it works perfectly well. So
I'm gonna show you exactly how we can build out this particular kind of tool.
I'm going to divide
the entire project into three different topics.
So the first one, we're going to create an encryption key.
And then the second video,
we're going to create both the encryption and decryption keys, the functions.
And then finally, in task number three, we will add the user interface.
So don't waste any more time. Let's get started.