Need to encrypt a string and store it in aN XML File.
From: Kevin Hodgson (kevin_at_caseware.com)
Date: 10/04/04
- Next message: CJ Taylor: "Re: Threading and raising events"
- Previous message: Larry Serflaten: "Re: Nearest point to the mouse cursor?"
- Next in thread: Jeff Johnson [MVP: VB]: "Re: Need to encrypt a string and store it in aN XML File."
- Reply: Jeff Johnson [MVP: VB]: "Re: Need to encrypt a string and store it in aN XML File."
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 4 Oct 2004 14:22:08 -0400
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
- Next message: CJ Taylor: "Re: Threading and raising events"
- Previous message: Larry Serflaten: "Re: Nearest point to the mouse cursor?"
- Next in thread: Jeff Johnson [MVP: VB]: "Re: Need to encrypt a string and store it in aN XML File."
- Reply: Jeff Johnson [MVP: VB]: "Re: Need to encrypt a string and store it in aN XML File."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|