473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Need to encrypt a string and store it in aN XML File.

I store a users SMTP UserName and Password in a settings class, which is
serialized to an XML Settings File.

I need to encrypt the password string in some manner. Does anyone have any
ideas how to do that and still store it in the XML File?
I was thinking of putting the Encryption/Decryption code in the Get/Set
methods of the SMTPPassword Property.

Sample Code:

Public Sub Persist()
'// Save the Settings object to XML Files
Dim settingsPath As String =
IO.Path.Combine(Application.UserAppDataPath, "settings.xml")
Dim myXMLSerializer As Xml.Serialization.XmlSerializer
Dim settingsFile As IO.StreamWriter

'//Save the settings class
myXMLSerializer = New
Xml.Serialization.XmlSerializer(GetType(Settings))
settingsFile = New IO.StreamWriter(settingsPath)
myXMLSerializer.Serialize(settingsFile, appSettings)
settingsFile.Close()
End Sub

<Serializable()> Public Class Settings
Dim m_SMTPLoginName as String
Dim m_SMTPPassword as String
Public Property SMTPLoginName() as String
Get
Return m_SMTPLoginName
End Get
Set(ByVal Value As String)
m_SMTPLoginName = Value
End Set
End Property
Public Property SMTPPassword() as String
Get
Return m_SMTPPassword
End Get
Set(ByVal Value As String)
m_SMTPPassword = Value
End Set
End Property
End Class
Nov 21 '05 #1
1 2022

"Kevin Hodgson" <ke***@caseware.com> wrote in message
news:uf**************@TK2MSFTNGP10.phx.gbl...
I need to encrypt the password string in some manner. Does anyone have
any
ideas how to do that and still store it in the XML File?


After you run it through your encryption routine of choice (a two-way
routine, of course), just base-64 encode the results (see the System.Text
namespace for the Encoding class). Then you'll have normal text that you can
stick in the XML file.
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Allan Bruce | last post by:
I want to load config from a file. I know how to load in numbers using an ifstream, but I cant get it to load a string. Can somebody tell me how to load a string from file? Here is my code: ...
9
by: Sharon | last post by:
hi, I want to extract a string from a file, if the file is like this: 1 This is the string 2 3 4 how could I extract the string, starting from the 10th position (i.e. "T") and...
7
by: Dan H. | last post by:
Hello, What is the equivalent "string resource file" in c#? And, is there a way to create a beep in C#? Thanks, Dan
2
by: Daniel | last post by:
Is there any way for System.IO.StreamWriter Write method to write out part of the string to file. such as if the machine is shut down half way through? or does the file not actually exist until the...
1
by: Timothy Wang | last post by:
Hi everyone : Is there anybody know how to use a string store in a variable as command ? Like : str1='test...' str2='...test' str3='left(str1, 5) & Right((str2,3 ) ' How do we get...
0
by: lima01 | last post by:
Hi there, I need to read key store file to get private key generated by Java's KeyTools from PHP. But seams like the keystore file is not in standard format that PHP can use. I need to do so...
15
by: Gan Quan | last post by:
I'm writing a c++ program that has many (100+) threads read/write files simultaneously. It works well if not considering the efficiency. The file i/o seems to be the bottleneck. This is my code...
0
by: divy | last post by:
Hi, I am working with Filenet. I have all the below specified WSDL files The elements and types defined in the CEWS schema are assigned to the following namespaces: Common WSDL:...
2
by: =?Utf-8?B?S3VtYXI=?= | last post by:
I am using granados telnet client for connecting to the telnet and get the data from it. Every thing appears to be going smooth. But for some reason when I try to write the byte data to a string or...
2
by: mahmoodn | last post by:
I want to pass a string as file name to a ifstream object, but I can't. char cnt_string = ""; string f = "ss_"; int cnt = 1; string seq = itoa(cnt, cnt_string, 10); string file = f+seq+".txt";...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.