[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Encrypt and decrypt a file using a DES algorithm

Posted on 2011-04-21
8
Medium Priority
?
578 Views
Last Modified: 2012-05-11
I am learning about Encryption and Decryption in VB.Net this time...
i found several articles and tutorials.
The one i use for sample purposes is http://www.vb-helper.com/howto_net_des_file.html
The example creates an output file that is encrypted..although the original file can be accessed..
I need some help here...i want my original file to be encrypted...
0
Comment
8 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 1000 total points
ID: 35442016
I think you have to move the original file to a temp location and then recreate it at original location. The temp file can then be deleted.
0
 
LVL 4

Expert Comment

by:jmaggio322
ID: 35442191
how about you just enrypt the original by either using the cipher command in a command prompt or encrypting it through the properties of the file. properties general tab advanced button and check encrypt this file
0
 
LVL 18

Author Comment

by:John (Yiannis) Toutountzoglou
ID: 35442219
So...
1.i've created an XML file in C:\Sqvars.xml
2.I have to move this file in temp directory
The Following Code Creates a temp file in my temp directory

Dim sTempFile As String = System.IO.Path.GetTempFileName()
        Dim fsTemp As New System.IO.FileStream(sTempFileName, IO.FileMode.Create)]

Open in new window

3.the output encrypt file should have the same name with my original one  (?)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 18

Author Comment

by:John (Yiannis) Toutountzoglou
ID: 35442254
jmaggio322
I dynamically creates this xml file...The encrypt option is unavailiable....
0
 
LVL 18

Author Comment

by:John (Yiannis) Toutountzoglou
ID: 35442488
Got it...
1.i move the original file to a temp location
2.I create encrypted File to my specific Location
and i do the opposite when i need the data of the file....
   Dim FileToMove As String
             Dim MoveLocation As String
             Dim sTempFileName As String = System.IO.Path.GetTempFileName()
        FileToMove = "C:\SqVars.xml"
        MoveLocation = System.IO.Path.GetTempPath & "SqVars.xml"
        If System.IO.File.Exists(FileToMove) = True Then
            System.IO.File.Move(FileToMove, MoveLocation)
        End If 

Open in new window

0
 
LVL 21
ID: 35442494
I would do this:

1)  create the XML file as temp file with a temp name. Not the name you want
2) encrypt  the temp file to a new fiel with the name you want.
3) delete the temp file that is not encrypted
0
 
LVL 21
ID: 35442518
How do you now the file is encrypted  if the name is the same for both the decrypted and encrypted version?
0
 
LVL 18

Author Comment

by:John (Yiannis) Toutountzoglou
ID: 35442521
TheHiTechCoach thank you for your post...
Already got it by CodeCruiser's Guideline..
Your comment is also helpfull that needs less actions..
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Screencast - Getting to Know the Pipeline
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question