Encryption and Decryption of password

code to encrypt and decrypt the password to and from the database.


Public Function EncryptConnectionString(ByVal stringValue As String) As String
Dim b As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(stringValue)
Dim encryptedConnectionString As String = Convert.ToBase64String(b)
Return encryptedConnectionString
End Function

''' <summary>
''' Method to Decrypt the string using Base64String algorithum
''' </summary>
''' <param name="stringValue">stringValue</param>
''' <returns>Decrypted string</returns>
Public Function DecryptConnectionString(ByVal stringValue As String) As String
Dim b As Byte() = Convert.FromBase64String(stringValue)
Dim decryptedConnectionString As String = System.Text.ASCIIEncoding.ASCII.GetString(b)
Return decryptedConnectionString
End Function


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: